PHP code example of meilunzhi / laravel-vue-admin

1. Go to this page and download the library: Download meilunzhi/laravel-vue-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/ */

    

meilunzhi / laravel-vue-admin example snippets


'providers' => [

    //...

    Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
    Spatie\Permission\PermissionServiceProvider::class,
    Cameron\Admin\AdminServiceProvider::class,
]

// 在guards中增加admin
    'guards' => [
        'admin' => [
            'driver' => 'jwt',
            'provider' => 'admin_users',
        ],
       
    ],
...
// 在providers中增加admin_users
    'providers' => [
        'admin_users' => [
             'driver' => 'eloquent',
             'model' => Cameron\Admin\Models\Auth\AdminUser::class,
                ],
    ]

 // 1. 一定要注释掉$middleware中将空字符串转换为null的中间件
    protected $middleware = [
        \App\Http\Middleware\TrustProxies::class,
        \Fruitcake\Cors\HandleCors::class,
        \App\Http\Middleware\CheckForMaintenanceMode::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        //注释这一行↓
//        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
    ];

 // 2. 在$middlewareGroups数组中的api下面增加
   ...
'api' => [
    \Cameron\Admin\Middleware\LogOperation::class,
],
...
 // 3. 在$routeMiddleware增加如下中间件
...
    'service' => \Cameron\Admin\Middleware\HasService::class,
    'permission' => \Cameron\Admin\Middleware\CheckPermission::class,
...

Schema::create('test', function (Blueprint $table) {
    $table->id();
    $table->string('name', '15');
    $table->string('status')->comment('状态:0=否,1=是');
    $table->timestamps();
});


Route::middleware(['service'])->group(function() {
    // Test
    Route::resource('test', 'TestController');

});


Route::get('/', function () {
    return view('index');
});

bash
php artisan vendor:publish --force
// 选择发布Tymon\JWTAuth\Providers\LaravelServiceProvider和Cameron\Admin\AdminServiceProvider
bash
php artisan jwt:secret
bash
php artisan admin:password account password
// 如
php artisan admin:password admin 123456
bash
php artisan migrate 
bash
php artisan admin:generate test --model=Test
bash
php artisan storage:link