Laravel 开始笔记
安装laravel http://laravelacademy.org/post/6665.html
然后需要再配置一下 timezone.
config/app.php
'timezone' => "Asia/Shanghai"
1. 引入 Repository 模式
https://github.com/andersao/l5-repository
ps:
php artisan migrate 时报错,
[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `administrators` add unique `account_unique`(`account`)) [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
解决方案:
修改 AppServiceProvider.php
use Illuminate\Support\Facades\Schema; /** * Bootstrap any application services. * * @return void */ public function boot() { Schema::defaultStringLength(191); }
其实设置的到 250 都可以成功创建,不确定后续在跑的时候会不会出问题。
https://laravel.com/docs/master/migrations#creating-indexes
2. artisan 传入负数报错
正确调用 `php artisan command:action -- -1`