app/Http/Controllers/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(Request $request, Role $role)
    {
        $this->authorize('haveaccess','role.edit');
        $request->validate([
            'name'          => 'required|max:50|unique:roles,name,'.$role->id,
            'slug'          => 'required|max:50|unique:roles,slug,'.$role->id,
            'full-access'   => 'required|in:yes,no'
        ]);
        $role->update($request->all());
        if ($request->get('permission')) {
            return $request->all();
            $role->permissions()->sync($request->get('permission'));
        }
        return redirect()->route('role.index')
            ->with('status_success','Role updated successfully'); 
    }
public function update ( Request $ request , Role $ role ) { $ this -> authorize ( 'haveaccess' , 'role.edit' ) ; $ request -> validate ( [ 'name' => 'required|max:50|unique:roles,name,' . $ role -> id , 'slug' => 'required|max:50|unique:roles,slug,' . $ role -> id , 'full-access' => 'required|in:yes,no' ] ) ; $ role -> update ( $ request -> all ( ) ) ; $ role -> permissions ( ) -> sync ( $ request -> get ( 'permission' ) ) ; return redirect ( ) -> route ( 'role.index' ) -> with ( 'status_success' , 'Role updated successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// //if ($request->get('permission')) { //return $request->all(); //}