mimiloca
2 days ago

Updating normal user to admin

Posted 2 days ago by mimiloca

I want to update normal user to admin.

this is what i have tried Im not getting any error but the data is not updated to0

    public function add(User $users, Request $request)
    {
        
        if($users->is_admin == '0')
        {
            $users->update(['is_admin'=> '1']);
        }
        
        $users->save();
       
        return redirect('admin.users')->with('success', 'Admin Added!');
    }


<div class="form-group row">
                    <label for="ic" class="col-sm-2 col-form-label">Is Admin</label>
                    <div class="col-sm-10">
                        <input type="number" class="form-control" name="is_admin" value="{{$users->is_admin}}" >
                    </div>
                  </div>

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