Simple Update not working.

Posted 3 months ago by hjortur17

Hi, I have an update feature for my app. I having a problem updating Users role in the app. When I submit the update form I'm redirected back but the change didn't go through. Any ideas?

This is my function:

public function update(Request $request, $id)
       {
              $user = User::where('id', '=', $id)->first();
              $user->update($request->all());

              return redirect()->route('dashboard');
       }

And this is the input:

<div class="flex items-center px-4 py-4">
    <div class="w-1/6">
        <p>Hlutverk</p>
    </div>
    <div class="w-5/6">
        <input class="appearance-none block w-full bg-grey-lighter text-grey-darker border-2 border-grey-lighter rounded py-2 px-4 leading-tight focus:outline-none focus:bg-white focus:border-yellow-dark" type="text" name="role" value="{{ $user->role }}">
    </div>
</div>

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.