app/Http/Controllers/admin/RoleController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $request->validate([
            'name' => 'required'
        ]
        );
        $role = Role::create($request->all());
        $role->permissions()->sync($request->permissions);
        return redirect()->route('admin.roles.edit', $role)->with('info', 'El rol se creó con éxito.');
    }
public function store ( Request $ request ) { $ request -> validate ( [ 'name' => 'required' ] ) ; $ role = Role :: create ( $ request -> all ( ) ) ; $ role -> permissions ( ) -> sync ( $ request -> permissions ) ; return redirect ( ) -> route ( 'admin.roles.edit' , $ role ) -> with ( 'info' , 'El rol se creó con éxito.'); }
Store a newly created resource in storage.
Store a newly created resource in storage .