Laravel 8 Does Not Update Information From Database

  laravel, laravel-8, php

I want to update my user information from database. I have this as form:

<form method="POST" action="{{ route('profile.update' , ['profile' => Auth::user()->id]) }}" class="form">
    <div class="form-group BSinaBold ">
        <input id="location" type="text" class="form-control" name="location" value="{{ Auth::user()->location }}" required autocomplete="location" autofocus>

And at the Controller, I put this in the method update:

public function update(Request $request, $profile)
        $validate_data = Validator::make(request()->all(),[
           'location' => 'required'

        $user = User::findOrFail($profile);

            'location' => $validate_data['location']

        return back();

But now the problem is, it does not update location. I mean there is no error appearing and no update at all!

So what’s going wrong here, how can I fix this?

I would really appreciate any idea or suggestion from you guys,


Source: Laravel

Leave a Reply