public function authorizePermissionResource($resource, array $options = [])
    {
        $permissions = $this->resourcePermissionMap();
        $collection  = new Collection;
        foreach ($permissions as $method => $ability) {
            $collection->push(new Fluent([
                'ability' => $ability,
                'method'  => $method,
            ]));
        }

        $collection->groupBy('ability')->each(function ($permission, $ability) use ($resource, $options) {
            $this->middleware("can:{$resource}.{$ability}")
                 ->only($permission->pluck('method')->toArray());
        });
    }
public function authorizePermissionResource($resource, array $options = [])
    {
        $permissions = $this->resourcePermissionMap();
        $collection  = new Collection;
        foreach ($permissions as $method => $ability) {
            $collection->push(new Fluent([
                'ability' => $ability,
                'method'  => $method,
            ]));
        }

        $collection->groupBy('ability')->each(function ($permission, $ability) use ($resource, $options) {
            $this->middleware("can:{$resource}.{$ability}")
                 ->only($permission->pluck('method')->toArray());
        });
    }
public function authorizePermissionResource ( $ resource , array $ options = [ ] ) { $ permissions = $ this -> resourcePermissionMap ( ) ; $ collection = new Collection ; foreach ( $ permissions as $ method => $ ability ) { $ collection -> push ( new Fluent ( [ 'ability' => $ ability , 'method' => $ method , ] ) ) ; } $ collection -> groupBy ( 'ability' ) -> each ( function ( $ permission , $ ability ) use ( $ resource , $ options ) { $ this -> middleware ( "can:{$resource}.{$ability}" ) -> only ( $ permission -> pluck ( 'method' ) -> toArray ( ) ) ; } ) ; }
Authorize a permission resource action based on the incoming request.

@param  string $resource
@param  array $options
@return void
Authorize a permission resource action based on the incoming request .