Am displaying user profile data from the database to an input field and at at the same time, the user should be able to update the input field
Controller.php
// shows details in input
Public function details()
{
$id = auth()->id;
$details=Users::where(‘id’,’=‘,$id)->first();
return view (‘profile’,compact(‘details’);
}
// Update function
Public function details()
{
// I don’t know what to do
}
blade.php
<form action=‘{{ route(‘update’) }} method=‘post’>
@csrf
<input type=‘text’ name=‘firstname’ value=‘{{ $details->firstname}}’ >
<input type=‘text’ name=‘lastname’ value=‘{{ $details->lastname}}’ >
<input type=‘submit’ value=‘Submit’ >
</form>
2
Answers
use IlluminateHttpRequest;
route:
blade:
I hope you find this useful,
Change your blade file:
Change your web.php file: