Randy_Johnson
3 months ago
289
3
General

Updating user DB

Posted 3 months ago by Randy_Johnson

Hi, I am having trouble updating user, there is no error, it just doesn't run.

Edit: I have a problem where the id is missing, I could easily put a input which isn't editable and push to the controller, but I would rather do it another way. I tried adding {slug} in the routes, but my method already has Request request in the parameters.

How do I get the id?

        if(DB::table('users')
            ->where('id', $request->input('id'))
            ->update(
                [
                    'name' => $request->input('name'),
                    'email' => $request->input('email'),
                    'password' => bcrypt($request->input('password')),
                    'is_admin' => $request->input('is_admin'),
                    'updated_at' => Carbon::now(),
                ]
            ))
            {
                return redirect()->route('read-users');
            }
            else 
            {
                return abort(404);
            }

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