Voyager的安装及配置文件

使用代理服务器安装laravel

http_proxy=http://localhost:1080 composer create-project --prefer-dist laravel/laravel blog

复制.env文件

php key:generate

将storage文件夹设置为可写

chmod -R 777 storage

将Bootstrap文件下

chmod 777 -R /bootstrap/cache/

下载voyager包

composer require tcg/voyager

安装voyager

php artisan voyager:install --with-dummy

配置服务器与网站

设置数据库:
CREATE DATABASE 'voyager';
CREATE DATABASE voyager;
CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456';
GRANT ALL ON voyager.* TO 'dog'@'localhost';

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/blog
sudo ln -s /etc/nginx/sites-available/blog /etc/nginx/sites-enabled/blog
修改/etc/hosts使本地也能够访问

默认用户:admin@admin.com
默认密码:password

将已有用户加入到管理员

php artisan voyager:admin your@email.com

如果你想创建一个新的管理员用户,你可以加上 --create 标志,

php artisan voyager:admin your@email.com --create

然后为这个用户添加管理源密码

常用配置信息

在config/voyager.php

'user' => [
        'add_default_role_on_register' => true,
        'default_role'                 => 'user',    // 默认角色
        // Set `namespace` to `null` to use `config('auth.providers.users.model')` value
        // Set `namespace` to a class to override auth user model.
        // However make sure the appointed class must ready to use before installing voyager.
        // Otherwise `php artisan voyager:install/` will fail with class not found error.
        'namespace'                    => null,
        'default_avatar'               => 'users/default.png',    //默认avatar
        'redirect'                     => '/admin',
    ],

/*
    |--------------------------------------------------------------------------
    | Controllers config
    |--------------------------------------------------------------------------
    |
    | Here you can specify voyager controller settings
    |
    */

    'controllers' => [
        'namespace' => 'TCG\\Voyager\\Http\\Controllers',
    ],
/*
    |--------------------------------------------------------------------------
    | Models config
    |--------------------------------------------------------------------------
    |
    | Here you can specify default model namespace when creating BREAD.
    | Must include trailing backslashes. If not defined the default application
    | namespace will be used.
    |
    */

    'models' => [
        //'namespace' => 'App\\',
    ],

默认存储位置

/*
    |--------------------------------------------------------------------------
    | Storage Config
    |--------------------------------------------------------------------------
    |
    | Here you can specify attributes related to your application file system
    |
    */

    'storage' => [
        'disk' => 'public',
    ],

在filesystems.php里写出了存储详细信息

/*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
    |
    */

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
        ],

    ],

设置隐藏文件和表:

/*
    |--------------------------------------------------------------------------
    | Media Manager
    |--------------------------------------------------------------------------
    |
    | Here you can specify if media manager can show hidden files like(.gitignore)
    |
    */

    'hidden_files' => false,

    /*
    |--------------------------------------------------------------------------
    | Database Config
    |--------------------------------------------------------------------------
    |
    | Here you can specify voyager database settings
    |
    */

    'database' => [
        'tables' => [
            'hidden' => ['migrations', 'data_rows', 'data_types', 'menu_items', 'password_resets', 'permission_role', 'settings'],
        ],
    ],

下拉菜单:

/*
    |--------------------------------------------------------------------------
    | Dashboard config
    |--------------------------------------------------------------------------
    |
    | Here you can modify some aspects of your dashboard
    |
    */

    'dashboard' => [
        // Add custom list items to navbar's dropdown
        'navbar_items' => [
            'Profile' => [
                'route'      => 'voyager.profile',
                'classes'    => 'class-full-of-rum',
                'icon_class' => 'voyager-person',
            ],
            'Home' => [
                'route'        => '/',
                'icon_class'   => 'voyager-home',
                'target_blank' => true,
            ],
            'Logout' => [
                'route'      => 'voyager.logout',
                'icon_class' => 'voyager-power',
            ],
        ],

        'widgets' => [

        ],

    ],
posted @ 2018-11-14 20:41  cicarius  阅读(1208)  评论(0编辑  收藏  举报