SQLSTATE[42S02]: Base table or view not found: 1146 Table 'app.infos' doesn't exist.
home controller
<?php
namespace App\Http\Controllers;
// use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\info;
class homeController extends Controller
{
public function index(){
$data=info::all();
return view('home',['data'=>$data]);
}
}
web php
Route::get('home', [homeController::class ,'index']);
CodePudding user response:
change your table 'info' to 'infos' or just add (protected $table = 'info') to your model
CodePudding user response:
Make sure table name is "infos" not info
After that run following command
php artisan migrate