vendredi 30 octobre 2015

Get the prefix in Laravel 5.1 -Dingo/Api

I am using Laravel 5.1 and Dingo/Api. Is there a way to get the route prefix in it? I tried the getLastGroupPrefix() but it always returns null

Here's my code

BaseController :

public function isAdminRequest()
    {
        return Route::getLastGroupPrefix();
    }

routes :

$api->group(array('prefix' => 'admin'), function($api)
    {
        $api->resource('users', "App\Http\Controllers\UsersController");
    });

and I'm trying to use it in my UsersController by doing so

    public function index()
    {
        return $this->isAdminRequest();
    }

But I just get a blank page.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire