jeudi 28 mars 2019

Replace Str::parseCallback() when upgrading from Laravel 4

I am upgrading an app from Laravel 4.2 to 5.0. I have a class that uses the Str: function from Illuminate support as follows:

public static function controllerActionName()
    {
        $routeArray = Str::parseCallback(Route::currentRouteAction(), null);
        if (last($routeArray) != null) {
            return str_slug(self::controllerName() . '-' . self::actionName());
        }
        return 'closure';
    }

There are several uses of this in the code. LaraShift says: "The alias for the Str Facade was removed in Laravel 5. While you may still import the Str Facade, you should review the following usages to see if they can be replaced with Laravel Helpers Functions or PHP String functions." For the life of me I can't find any documentation on what was supposed to replace this so I can change the syntax. I know there is a library but I'd like to do this right and use current methodology.

https://gist.github.com/dwightwatson/6200599 or https://laravel.com/api/5.2/Illuminate/Support/Str.html



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire