app/Http/Controllers/RolesController.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(Role $role)
    {
          $shift = new Shift();
        $role->name=request('name');
        $permission->name=(request('permission_create'));
        if(request('create')){
          $role->givePermissionTo('create');
        }
        if(request('read')){
          $role->givePermissionTo('read');
        }
        if(request('update')){
          $role->givePermissionTo('update');
        }
        if(request('delete')){
          $role->givePermissionTo('delete');
        }
        $role->save();
        $permission->save();
        return redirect('/role');
          }
public function store ( Role $ role ) { $ role -> name = request ( 'name' ) ; if ( request ( 'create' ) ) { $ role -> givePermissionTo ( 'create' ) ; } if ( request ( 'read' ) ) { $ role -> givePermissionTo ( 'read' ) ; } if ( request ( 'update' ) ) { $ role -> givePermissionTo ( 'update' ) ; } if ( request ( 'delete' ) ) { $ role -> givePermissionTo ( 'delete' ) ; } $ role -> save ( ) ; return redirect ( '/role' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// //$shift = new Shift(); //$permission->name=(request('permission_create')); //$permission->save();