Laravel-layui-admin 是一个基于 Laravel、Layui 构建的基础后台管理系统。
首先安装laravel, 并且确保你配置了正确的数据库连接。
composer require moell/laravel-layui-admin
然后运行下面的命令来发布资源和配置:
php artisan laravel-layui-admin:install
在config/auth.php中添加相应的 guards 和 providers,如下:
config/auth.php
'guards' => [ ... 'admin' => [ 'driver' => 'session', 'provider' => 'admin' ] ], 'providers' => [ ... 'admin' => [ 'driver' => 'eloquent', 'model' => \Moell\LayuiAdmin\Models\AdminUser::class, ] ],
在 app/Http/Kernel.php 中 $routeMiddleware 属性添加路由中间admin.permission 和替换 auth 中间件:
app/Http/Kernel.php
admin.permission
class Kernel extends HttpKernel { protected $routeMiddleware = [ //'auth' => \App\Http\Middleware\Authenticate::class, 'auth' => \Moell\LayuiAdmin\Http\Middleware\Authenticate::class, ... 'admin.permission' => \Moell\LayuiAdmin\Http\Middleware\Authenticate::class, ]; }
执行数据迁移,数据填充
php artisan migrate php artisan db:seed --class="Moell\LayuiAdmin\Database\LayuiAdminTableSeeder"
登录
url: http://localhost/admin/login
email: admin@gmail.com
password: secret