app/Http/Controllers/RoleController.php
/**
     * Update the specified role in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified role in storage.
Update the specified role in storage .
public function update(Request $request, $id)
    {
        $role = Role::find($id);
        $role->update($request->except('permissions') + ['ts_update' => Carbon::now()->timestamp]);
        $role->permissions()->delete();
        foreach ($request->all()['permissions'] as $value) {
            $role->permissions()->create(['module' => $value[0], 'type' => $value[2]]);
        }
        return redirect()->route('role.index')->with('edit', 'The selected user role has been updated');
    }
public function update ( Request $ request , $ id ) { $ role = Role :: find ( $ id ) ; $ role -> update ( $ request -> except ( 'permissions' ) + [ 'ts_update' => Carbon :: now ( ) -> timestamp ] ) ; $ role -> permissions ( ) -> delete ( ) ; foreach ( $ request -> all ( ) [ 'permissions' ] as $ value ) { $ role -> permissions ( ) -> create ( [ 'module' => $ value [ 0 ] , 'type' => $ value [ 2 ] ] ) ; } return redirect ( ) -> route ( 'role.index' ) -> with ( 'edit' , 'The selected user role has been updated' ) ; }
Update the specified role in storage.
Update the specified role in storage .