2017-08-17 76 views
1

的productTable基表或視圖未找到錯誤

public function up() 
{ 
    Schema::create('product', function (Blueprint $table) { 
     $table->increments('id'); 
     $table->string('name'); 
     $table->string('description'); 
     $table->string('type'); 
     $table->integer('size'); 
     $table->integer('price'); 
     $table->string('image')->nullable(); 
     $table->timestamps(); 
    }); 
} 

當我點擊提交,我得到了錯誤,說基礎表中找不到

+0

基於控制器代碼,我可以說你傳遞視圖名稱'Success'可能是錯誤的給定。 如果這不起作用的解決方案,請提供您的模型+驗證(如果已執行)深挖的詳細信息。 –

回答

2

Laravel找不到表的prular形式您使用的名稱,只需在您的模型上指定您的表名即可;並檢查您的視圖藏漢確保你的資源/查看您有一個名爲successs.blade.php

public $table = "yourTableName"; 
+0

謝謝!它的工作:) –

+0

@DanielAsyraf :)請標記爲答案,並投票了謝謝你 –

0

可能是你的表文件不在數據庫中可用,因此首先添加表中 數據庫。在你的模型像這樣

public $table = "yourTableName"; 
後,在模型中定義的表

只是遷移表中您的數據庫

php artisan make:migration 
相關問題