安装laravel框架--注意要安装好composer
composer create-project --prefer-dist laravel/laravel
安装laravel-admin
#安装laravel-admin扩展
composer require encore/laravel-admin
#发布资源
php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
#安装laravel-admin
php artisan admin:install
错误解决
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long;
max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))
<?php
/*
* @Author: your name
* @Date: 2021-07-29 09:40:31
* @LastEditTime: 2021-07-29 09:54:07
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \laravel\app\Providers\AppServiceProvider.php
*/
namespace App\Providers;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Schema::defaultStringLength(191);
}
}
添加报错解决方案
在config/filesystems.php 添加如下内容
'admin' => [
'driver' => 'local',
'root'=>public_path('upload'),
'visibility'=>'public',
'url'=>env('APP_URL').'/public/upload/',
],
http://www.loc.laravel.com/index.php/admin/auth/users
账号:admin
密码:admin
注意:
图片加载问题:图片加载可能存在加载不出来,主要是因为env文件配置问题,和文件目录问题
文件filesystems.php
'admin' => [
'driver' => 'local',
'root'=>public_path('upload'),
'visibility'=>'public',
'url'=>env('APP_URL').'/upload/',
],
.env文件修改