app/Http/Controllers/AdminController.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(Request $request, $id)
    {
        $admin = Admin::find($id);
        $admin->firstname = $request->firstname;
        $admin->lastname = $request->lastname;
        $admin->username = $request->username;
        $admin->password = Hash::make($request->password);
        $admin->faction = $request->faction;
        $admin->email = $request->email;
        $admin->phone = $request->phone;
        if($admin->save()){
            $error = [1,'แก้ไขผู้ใช้สำเร็จ'];
        }else{
            $error = [0,'เกิดข้อผิดพลาดบางอย่าง โปรดติดต่อแอดมิน'];
        }
        return redirect()->route('admin.index')->with(['result'=>$error[0],'text'=>$error[1]]);
    }
public function update ( Request $ request , $ id ) { $ admin = Admin :: find ( $ id ) ; $ admin -> firstname = $ request -> firstname ; $ admin -> lastname = $ request -> lastname ; $ admin -> username = $ request -> username ; $ admin -> password = Hash :: make ( $ request -> password ) ; $ admin -> faction = $ request -> faction ; $ admin -> email = $ request -> email ; $ admin -> phone = $ request -> phone ; if ( $ admin -> save ( ) ) { $ error = [ 1 , 'แก้ไขผู้ใช้สำเร็จ']; } else { $ error = [ 0 , 'เกิดข้อผิดพลาดบางอย่าง โปรดติดต่อแอดมิน']; } return redirect ( ) -> route ( 'admin.index' ) -> with ( [ 'result' => $ error [ 0 ] , 'text' => $ error [ 1 ] ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//