Laravel 5.2.2 的 module 和 table 命名规则
Route::get('/etutor/{category}', function ( $category ) {
$category = Category::orderBy('created_at', 'asc')->get();
return view('course.list', [
'categorys' => $category
]);
});
如上代码执行时报错,页面提示
QueryException in Connection.php line 651: SQLSTATE[42S02]: Base table而我创建的表名是category,laravel 竟然自认为是复数。
or view not found: 1146 Table 'test.categories' doesn't exist (SQL:
select * from categories order by created_at asc)
那里可以配置,以避免 laravel 瞎猜?
1 个回复
samubra
赞同来自: