app/Http/Controllers/Backsite/UserController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(UpdateUserRequest $request, User $user)
    {
        $data = $request->all();
        $user->update($data);
        $user->role()->sync($request->input('role', []));
        $detail_user = DetailUser::find($user['id']);
        $detail_user->type_user_id = $request['type_user_id'];
        $detail_user->save();
        alert()->success('Success Message', 'Successfully updated user');
        return redirect()->route('backsite.user.index');
    }
public function update ( UpdateUserRequest $ request , User $ user ) { $ data = $ request -> all ( ) ; $ user -> update ( $ data ) ; $ user -> role ( ) -> sync ( $ request -> input ( 'role' , [ ] ) ) ; $ detail_user = DetailUser :: find ( $ user [ 'id' ] ) ; $ detail_user -> type_user_id = $ request [ 'type_user_id' ] ; $ detail_user -> save ( ) ; alert ( ) -> success ( 'Success Message' , 'Successfully updated user' ) ; return redirect ( ) -> route ( 'backsite.user.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// get all request from frontsite // update to database // update roles // save to detail user , to set type user