43 lines
943 B
PHP
43 lines
943 B
PHP
<?php
|
|
|
|
namespace App\Agent;
|
|
|
|
use App\Agent\Middleware\Authenticate;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AgentServiceProvider extends ServiceProvider
|
|
{
|
|
protected $routeMiddleware = [
|
|
'auth.agent' => Authenticate::class,
|
|
];
|
|
|
|
public function boot()
|
|
{
|
|
$this->loadViewsFrom(__DIR__ . '/Views', 'Agent');
|
|
}
|
|
|
|
public function register()
|
|
{
|
|
$this->registerRouteMiddleware();
|
|
$this->loadAgentRoutes();
|
|
}
|
|
|
|
protected function registerRouteMiddleware()
|
|
{
|
|
foreach ($this->routeMiddleware as $key => $middleware) {
|
|
Route::aliasMiddleware($key, $middleware);
|
|
}
|
|
}
|
|
|
|
protected function loadAgentRoutes()
|
|
{
|
|
Route::middleware('web')
|
|
->prefix('agent')
|
|
->name('Agent.')
|
|
->namespace('App\Agent\Controllers')
|
|
->group(__DIR__ . '/routes.php');
|
|
}
|
|
|
|
}
|