1. Go to this page and download the library: Download lazywe/lazy-admin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lazywe / lazy-admin example snippets
//...
/**
* Define the routes for the application.
*/
public function map()
{
//...
//加载后台权限组
$this->mapAdminRoutes();
}
/**
* 加载后台权限组
*/
protected function mapAdminRoutes()
{
Route::prefix(config('lazy-admin.prefix'))
->middleware('web', 'lazy-admin')
->namespace(sprintf("%s\Admin", $this->namespace))
->group(function ($router) {
// 后台路由文件在routes下的admin目录下 路由文件分组
foreach (glob(base_path('routes/admin') . '/*.php') as $file) {
$router->group([], $file);
}
});
}
// ...