You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
770 B
37 lines
770 B
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Controller;
|
|
|
|
class ProfileController extends Controller
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
public function show()
|
|
{
|
|
return view('auth.profile', ['user' => auth()->user()]);
|
|
}
|
|
|
|
public function update(Request $request)
|
|
{
|
|
$profileData = $request->validate([
|
|
'name' => 'required|max:60',
|
|
'email' => 'required|email',
|
|
]);
|
|
|
|
$user = auth()->user();
|
|
|
|
$user->name = $profileData['name'];
|
|
$user->email = $profileData['email'];
|
|
$user->save();
|
|
|
|
flash()->success(trans('auth.profile_updated'));
|
|
return back();
|
|
}
|
|
|
|
}
|