Files
pingan_new/app/Merchant/MerchantServiceProvider.php
2020-08-06 16:42:18 +08:00

50 lines
1.2 KiB
PHP

<?php
namespace App\Merchant;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
class MerchantServiceProvider extends ServiceProvider
{
protected $routeMiddleware = [
'merchant.auth' => Middleware\Authenticate::class,
'merchant.guest' => Middleware\Guest::class,
];
protected $middlewareGroups = [
'merchant' => [
'merchant.auth',
],
];
public function boot()
{
$this->publishes([__DIR__ . '/Resources/assets' => public_path('assets/merchant')]);
$this->loadViewsFrom(__DIR__ . '/Resources/views', 'Merchant');
}
public function register()
{
$this->registerRouteMiddleware();
$this->loadAdminRoutes();
}
protected function registerRouteMiddleware()
{
foreach ($this->routeMiddleware as $key => $middleware) {
Route::aliasMiddleware($key, $middleware);
}
}
protected function loadAdminRoutes()
{
Route::middleware('web')
->prefix('merchant')
->name('merchant.')
->namespace('App\Merchant\Controllers')
->group(__DIR__ . '/routes.php');
}
}