src/Route.php
public static function generateCrudEndpoints(string $permission, string $endpoint)
    {
        return collect(self::ROUTE_CRUD_PERMISSION)
            ->map(function ($suffix, $method) use ($permission, $endpoint) {
                if (Gate::allows("{$permission}_{$suffix}")) {
                    return [$method => $endpoint];
                }
            })->collapse();
    }
public static function generateCrudEndpoints(string $permission, string $endpoint)
    {
        return collect(self::ROUTE_CRUD_PERMISSION)
            ->map(function ($suffix, $method) use ($permission, $endpoint) {
                if (Gate::allows("{$permission}_{$suffix}")) {
                    return [$method => $endpoint];
                }
            })->collapse();
    }
public static function generateCrudEndpoints ( string $ permission , string $ endpoint ) { return collect ( self :: ROUTE_CRUD_PERMISSION ) -> map ( function ( $ suffix , $ method ) use ( $ permission , $ endpoint ) { if ( Gate :: allows ( "{$permission}_{$suffix}" ) ) { return [ $ method => $ endpoint ] ; } } ) -> collapse ( ) ; }
Creates a valid array of required endpoints based on the user's permissions

@param string $permission
@param string $endpoint
@return Array
Creates a valid array of required endpoints based on the user s permissions