提交代码
This commit is contained in:
42
app/Agent/AgentServiceProvider.php
Normal file
42
app/Agent/AgentServiceProvider.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user