vendredi 31 mars 2017

Laravel routes and route:cache

I have the following in my routes.php

Route::pattern('slug', '[a-zA-Z0-9\-_\/+]');
$slug = Request::path();
if(isset($slug)) {
    $slug_array = explode('/', $slug);
    if($slug_array[0] != 'version' && $slug_array[0] != 'api') {
        $slug = explode($slug, '/');
        Route::any('/{slug}', 'Frontend\PagesController@index')->where('slug', '[a-zA-Z0-9\-_\/]+');
    } else {
        if($slug_array[0] == 'api') {
            Route::any('/{slug}', 'Custom\ApiController@init')->where('slug', '[a-zA-Z0-9\-_\/]+');
        }
    }
}

When I do a php artisan route:cache the routes for Route::any('/{slug}', 'Frontend\PagesController@index')->where('slug', '[a-zA-Z0-9\-_\/]+'); work fine. But the 'Custom\ApiController@init' is completely ignored.

How can I go about it that it's also cached?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ohQc8Q
via IFTTT

Aucun commentaire:

Enregistrer un commentaire