31 lines
706 B
PHP
31 lines
706 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers\Settings;
|
||
|
|
||
|
use App\Http\Controllers\Controller;
|
||
|
use Illuminate\Http\Request;
|
||
|
|
||
|
class ProfileController extends Controller
|
||
|
{
|
||
|
/**
|
||
|
* Update the user's profile information.
|
||
|
*
|
||
|
* @param \Illuminate\Http\Request $request
|
||
|
* @return \Illuminate\Http\Response
|
||
|
*/
|
||
|
public function update(Request $request)
|
||
|
{
|
||
|
$user = $request->user();
|
||
|
|
||
|
$this->validate($request, [
|
||
|
'name' => 'required',
|
||
|
'email' => 'required|email|unique:users,email,'.$user->id,
|
||
|
]);
|
||
|
|
||
|
return tap($user)->update([
|
||
|
'name' => $request->name,
|
||
|
'email' => strtolower($request->email),
|
||
|
]);
|
||
|
}
|
||
|
}
|