Laravel – admin 的安装

Posted by

Laravel-admin 的安装


composer require encore/laravel-admin:1.*


php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"



php artisan admin:install
yshuqdeMacBook-Pro:laravel5 yshuq$ composer require encore/laravel-admin:1.*
./composer.json has been updated
Running composer update encore/laravel-admin
Loading composer repositories with package information
Updating dependencies
Lock file operations: 8 installs, 0 updates, 0 removals
  - Locking doctrine/cache (2.1.1)
  - Locking doctrine/dbal (3.3.2)
  - Locking doctrine/deprecations (v0.5.3)
  - Locking doctrine/event-manager (1.1.1)
  - Locking encore/laravel-admin (v1.8.17)
  - Locking psr/cache (1.0.1)
  - Locking symfony/deprecation-contracts (v2.5.0)
  - Locking symfony/dom-crawler (v5.4.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 8 installs, 0 updates, 0 removals
  - Installing doctrine/cache (2.1.1): Extracting archive
  - Installing doctrine/deprecations (v0.5.3): Extracting archive
  - Installing doctrine/event-manager (1.1.1): Extracting archive
  - Installing symfony/deprecation-contracts (v2.5.0): Extracting archive
  - Installing symfony/dom-crawler (v5.4.3): Extracting archive
  - Installing psr/cache (1.0.1): Extracting archive
  - Installing doctrine/dbal (3.3.2): Extracting archive
  - Installing encore/laravel-admin (v1.8.17): Extracting archive
3 package suggestions were added by new dependencies, use `composer suggest` to see details.
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: encore/laravel-admin
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.
46 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
yshuqdeMacBook-Pro:laravel5 yshuq$ php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
Copied Directory [/vendor/encore/laravel-admin/config] To [/config]
Copied Directory [/vendor/encore/laravel-admin/resources/lang] To [/resources/lang]
Copied Directory [/vendor/encore/laravel-admin/database/migrations] To [/database/migrations]
Copied Directory [/vendor/encore/laravel-admin/resources/assets] To [/public/vendor/laravel-admin]
Publishing complete.
yshuqdeMacBook-Pro:laravel5 yshuq$ php artisan admin:install
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table
Migrating: 2016_01_04_173148_create_admin_tables
Migrated:  2016_01_04_173148_create_admin_tables
Admin directory was created: /app/Admin
HomeController file was created: /app/Admin/Controllers/HomeController.php
AuthController file was created: /app/Admin/Controllers/AuthController.php
ExampleController file was created: /app/Admin/Controllers/ExampleController.php
Bootstrap file was created: /app/Admin/bootstrap.php
Routes file was created: /app/Admin/routes.php
yshuqdeMacBook-Pro:laravel5 yshuq$


SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter tableusersadd uniqueusers_email_unique(email))


启动服务后,在浏览器打开 http://localhost/admin/ ,使用用户名 admin 和密码 admin登录.







├── Controllers
│   ├── ExampleController.php
│   └── HomeController.php
├── bootstrap.php
└── routes.php


app/Admin/bootstrap.php 是laravel-admin的启动文件, 使用方法请参考文件里面的注释.