app/Http/Controllers/__Old__/__RoleController.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(UpdateRoleRequest $request, $id)
    {
        $role = Role::find($id);
            $role->name = $request->input('name');
            $role->display_name = $request->input('display_name');
            $role->description = $request->input('description');
        $role->save();
        DB::table("permission_role")->where("permission_role.role_id",$id)
            ->delete();
        foreach ($request->input('permission') as $key => $value) {
            $role->attachPermission($value);
        }
        return redirect()->route('roles.index')
                        ->with('success','Role updated successfully');
    }
public function update ( UpdateRoleRequest $ request , $ id ) { $ role = Role :: find ( $ id ) ; $ role -> name = $ request -> input ( 'name' ) ; $ role -> display_name = $ request -> input ( 'display_name' ) ; $ role -> description = $ request -> input ( 'description' ) ; $ role -> save ( ) ; DB :: table ( " permission_role " ) -> where ( " permission_role.role_id " , $ id ) -> delete ( ) ; foreach ( $ request -> input ( 'permission' ) as $ key => $ value ) { $ role -> attachPermission ( $ value ) ; } return redirect ( ) -> route ( 'roles.index' ) -> with ( 'success' , 'Role updated successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .