課程
/后端開發
/PHP
/輕松學會Laravel-高級篇
顯示指定密鑰太長了
2018-03-13
源自:輕松學會Laravel-高級篇 4-1
正在回答
剛好我也遇到了。可能是數據長度沒有指定,造成超長
你在migrate的代碼里加入 Schema::defaultStringLength(191);
如下
public function up()
? ? {
? ? ? ? Schema::defaultStringLength(191); //new add
? ? ? ? Schema::create('users', function (Blueprint $table) {
? ? ? ? ? ? $table->increments('id');
? ? ? ? ? ? $table->string('name');
? ? ? ? ? ? $table->string('email')->unique();
? ? ? ? ? ? $table->string('password');
? ? ? ? ? ? $table->rememberToken();
? ? ? ? ? ? $table->timestamps();
? ? ? ? });
然后
在cmd里面執行
php artisan migrate:fresh?
//刪除原數據表并新建
就行了
舉報
Laravel框架高級教程,介紹Laravel提供的工具和功能,快來體驗
1 回答laravel是不是沒寫一個方法需要定義一個路由?會不會太麻煩了
5 回答php artisan migrate指令報錯,求解
2 回答使用 Storage::disk() 會報錯
3 回答運行php artisan 會報錯
1 回答為什么會出現沒有發現Storage這個類
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-03-26
剛好我也遇到了。可能是數據長度沒有指定,造成超長
你在migrate的代碼里加入 Schema::defaultStringLength(191);
如下
public function up()
? ? {
? ? ? ? Schema::defaultStringLength(191); //new add
? ? ? ? Schema::create('users', function (Blueprint $table) {
? ? ? ? ? ? $table->increments('id');
? ? ? ? ? ? $table->string('name');
? ? ? ? ? ? $table->string('email')->unique();
? ? ? ? ? ? $table->string('password');
? ? ? ? ? ? $table->rememberToken();
? ? ? ? ? ? $table->timestamps();
? ? ? ? });
然后
在cmd里面執行
php artisan migrate:fresh?
//刪除原數據表并新建
就行了