使用Voyager快速搭建一个Laravel的管理后台

Posted by

Voyager是The Control Group开发的一个基于Laravel的后台管理系统,可以帮助开发人员快速搭建一个带授权的后台。以下是教程和注意事项,官方文档地址是:https://voyager.readme.io/docs/installation

安装前准备

需要服务器安装好php7以上和composer。

第一步:使用composer全局安装laravel

composer global require "laravel/installer"

第二步:创建一个laravel的新项目your-project-name

composer create-project --prefer-dist laravel/laravel your-project-name

这个命令会创建一个最新版本的laravel项目,目前最新版本为Laravel5.5.13。

第三步:通过composer添加Voyager

composer require tcg/voyager

第四步:安装可能出现的问题

如果你的mysql数据库版本低于5.7.7,可能会出现 “Specified key was too long error.”的报错。这是一个laravel5.4就有的一个问题,解决方法如下:修改App/Providers/AppServiceProvider.php文件,代码如下;

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}

第五步:安装Voyager,附带数据

php artisan voyager:install --with-dummy

第六步:创建一个管理员

如果您使用php artisan voyager:install --with-dummy命令安装Voyager,Voyager会创建一个默认的管理员。

email: admin@admin.com
password: password

否则可以使用php artisan voyager:admin your@email.com –create命令创建一个管理员。

第七步:symlink(): Protocol error报错的解决方法

在widows下,通过Vagrant启动的虚拟机里安装Voyager可能会出现这个报错信息,造成问题是因为你用的终端命令行工具,没有使用windows的管理员权限执行。

你执行php artisan voyager:install --with-dummy的cmd需要使用管理员权限执行;

然后再在命令行执行php artisan storage:link 命令。

6 comments

  1. 请问您是否有尝试过在cpanel的虚拟主机环境下成功配置voyager呢?

  2. To view analytics you’ll need to get a google analytics client id and add it to your settings for the key google_analytics_client_id. Get your key in your Google developer console: https://console.developers.google.com

    这个怎么解决

  3. 我安装过了,可是我怎么访问voyager搭建的后台呢?

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据