4
0
Fork 0

add route web.php

master
panliang 2022-07-27 15:06:41 +08:00
parent fe7f1276d8
commit bea4d94338
2 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,9 @@
<?php
namespace Peidikeji\Keywords\Http\Controllers;
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => 'api', 'prefix' => 'api'], function () {
Route::get('keywords', [KeywordsController::class, 'json']);
});

View File

@ -391,13 +391,16 @@ abstract class ServiceProvider extends LaravelServiceProvider
*/
public function registerRoutes($callback)
{
// $this->loadRoutesFrom($callback);
Admin::app()->routes(function ($router) use ($callback) {
$router->group([
'prefix' => config('admin.route.prefix'),
'middleware' => config('admin.route.middleware'),
], $callback);
});
$webRoute = $this->getRoutes('web.php');
if ($webRoute) {
$this->loadRoutesFrom($webRoute);
}
}
/**
@ -485,9 +488,9 @@ abstract class ServiceProvider extends LaravelServiceProvider
*
* @throws \ReflectionException
*/
final public function getRoutes()
final public function getRoutes($name = 'routes.php')
{
$path = $this->path('src/Http/routes.php');
$path = $this->path('src/Http/' . $name);
return is_file($path) ? $path : null;
}