.env
APP_URL=http://hoge.hogehoge.com DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=XXXXXXX DB_USERNAME=XXXXXXX DB_PASSWORD=XXXXXXX
※laravel newの後で実行
composer require encore/laravel-admin php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider" php artisan admin:install
$ php artisan admin:install Migrating: 2014_10_12_000000_create_users_table Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` varchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8 collate 'utf8_unicode_ci') at /var/www/vhost/portal.kumolabo.com/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) { > 664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668| Exception trace: 1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists") /var/www/vhost/portal.kumolabo.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119 2 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists") /var/www/vhost/portal.kumolabo.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117 Please use the argument -v to see more details.
Laravel5.4以上
MySQL5.7.7未満
MySQL5.7.7以前のバージョンでは、PRIMARY_KEYおよびUNIQUE_KEYを付けたカラムには最大767bytesまでしか入らない。
5.7.7以上にすれば、PRIMARY_KEYおよびUNIQUE_KEYを付けたカラムに767bytes以上のデータが入る。
laravel側のcharsetをUTF-8に変える。
laravel5.3までは、charsetの標準設定はUTF-8だった。
$ cat config/database.php | grep utf8mb4 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', ↓ $ cat config/database.php | grep utf8mb4 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci',
varchar(191) のカラムを作成すれば、191 * 4 = 764bytesのため、エラーが発生しない。
app/Providers/AppServiceProvider.php
use Illuminate\Support\Facades\Schema; public function boot() { Schema::defaultStringLength(191); }
Disk [admin] not configured, please add a disk config in `config/filesystems.php`.
config/filesystems.phpに下記を追加する。
config/filesystems.php
'disks' => [ ... , 'admin' => [ 'driver' => 'local', 'root' => public_path('uploads'), 'visibility' => 'public', 'url' => env('APP_URL').'/uploads', ], ],