mercredi 28 mars 2018

How to use with routes in Laravel 5.6?

I create 2 route (web.php and admin.php) in Laravel 5.6.

RouteServiceProvider.php:

public function map()
{
    $this->mapApiRoutes();

    $this->mapWebRoutes();

    $this->mapAdminRoutes();
}

protected function mapWebRoutes()
{
    Route::middleware('web')
         ->namespace($this->namespace)
         ->group(base_path('routes/web.php'));
}

protected function mapAdminRoutes()
{
    Route::middleware(['web', 'adminInformation'])
        ->prefix('manage')
        ->namespace($this->namespace)
        ->group(base_path('routes/admin.php'));
}

Now i need get just controller names in admin.php.

For example:

$r = \Route::getRoutes();
    foreach ($r as $value) {

        echo($value->getName() . "<br />");
    }

Method Route::getRoutes() show all routes (web.php & admin.php).

How to get name controller just from admin.php?



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

Aucun commentaire:

Enregistrer un commentaire