mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
29 lines
637 B
PHP
29 lines
637 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\API;
|
||
|
|
||
|
use App\Http\Requests\API\ProfileUpdateRequest;
|
||
|
use App\Models\User;
|
||
|
use Hash;
|
||
|
|
||
|
class ProfileController extends Controller
|
||
|
{
|
||
|
/**
|
||
|
* Update the current user's profile.
|
||
|
*
|
||
|
* @param ProfileUpdateRequest $request
|
||
|
*
|
||
|
* @return \Illuminate\Http\JsonResponse
|
||
|
*/
|
||
|
public function update(ProfileUpdateRequest $request)
|
||
|
{
|
||
|
$data = $request->only('name', 'email');
|
||
|
|
||
|
if ($password = $request->input('password')) {
|
||
|
$data['password'] = Hash::make($password);
|
||
|
}
|
||
|
|
||
|
return response()->json(auth()->user()->update($data));
|
||
|
}
|
||
|
}
|