src/Http/Controllers/AuthorizedController.php
protected function mapResourceAbilities(): array
    {
        // Reflect calling controller
        $controller = new ReflectionClass(static::class);

        // Get public methods and filter magic methods
        $methods = array_filter($controller->getMethods(ReflectionMethod::IS_PUBLIC), function ($item) use ($controller) {
            return $item->class === $controller->name && mb_substr($item->name, 0, 2) !== '__' && ! in_array($item->name, $this->resourceActionWhitelist);
        });

        // Get controller actions
        $actions = array_combine($items = array_map(function ($action) {
            return $action->name;
        }, $methods), $items);

        // Map resource actions to resourse abilities
        array_walk($actions, function ($value, $key) use (&$actions) {
            $actions[$key] = array_get($this->resourceAbilityMap(), $key, $value);
        });

        return $actions;
    }
protected function mapResourceAbilities(): array
    {
        // Reflect calling controller
        $controller = new ReflectionClass(static::class);

        // Get public methods and filter magic methods
        $methods = array_filter($controller->getMethods(ReflectionMethod::IS_PUBLIC), function ($item) use ($controller) {
            return $item->class === $controller->name && mb_substr($item->name, 0, 2) !== '__' && ! in_array($item->name, $this->resourceActionWhitelist);
        });

        // Get controller actions
        $actions = array_combine($items = array_map(function ($action) {
            return $action->name;
        }, $methods), $items);

        // Map resource actions to resourse abilities
        array_walk($actions, function ($value, $key) use (&$actions) {
            $actions[$key] = array_get($this->resourceAbilityMap(), $key, $value);
        });

        return $actions;
    }
protected function mapResourceAbilities ( ) : array { // Reflect calling controller $ controller = new ReflectionClass ( static :: class ) ; // Get public methods and filter magic methods $ methods = array_filter ( $ controller -> getMethods ( ReflectionMethod :: IS_PUBLIC ) , function ( $ item ) use ( $ controller ) { return $ item -> class === $ controller -> name && mb_substr ( $ item -> name , 0 , 2 ) !== '__' && ! in_array ( $ item -> name , $ this -> resourceActionWhitelist ) ; } ) ; // Get controller actions $ actions = array_combine ( $ items = array_map ( function ( $ action ) { return $ action -> name ; } , $ methods ) , $ items ) ; // Map resource actions to resourse abilities array_walk ( $ actions , function ( $ value , $ key ) use ( & $ actions ) { $ actions [ $ key ] = array_get ( $ this -> resourceAbilityMap ( ) , $ key , $ value ) ; } ) ; return $ actions ; }
Map resource actions to resource abilities.

@throws \ReflectionException

@return array
Map resource actions to resource abilities .