PHP code example of moell / mojito

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

    

moell / mojito example snippets


return [
    'guards' => [
        // laravel-permission 相对应的 guard
        'admin' => [
            'model' => \Moell\Mojito\Models\AdminUser::class, //登录鉴权的模型
            'login_fields' => [	// 登录验证的字段,支持多个
                'username',
            ],
            'conditions' => [ // 登录验证的额外条件
                ['status', '=', 1]
            ]
        ]
    ],
    'route_prefix' => "api", //路由前缀
    
    'middleware' => [
        'basic' => 'api', //基础中间件

        'auth' => ['auth:sanctum'], //鉴权中间件

        'permission' => ['auth:sanctum', 'mojito.permission'] //包含权限检测的中间件
    ]
];

php artisan mojito:install

php artisan migrate

php artisan db:seed --class="Moell\Mojito\Database\MojitoTableSeeder"