今天遇到了一个问题,在routes/web.php中配置了路由,但始终无法访问该路由,一直报404。
Route::resource('gift_packs', 'GiftPacksController', ['only' => ['index', 'show', 'create', 'store', 'update', 'edit', 'destroy']]);
Route::get('gift_packs/test', 'GiftPacksController@test')->name('gift_packs.test');
然后我在app/Exceptions/Handler.php文件中,修改render()方法:
public function render($request, Exception $exception)
{
dd($exception);
return parent::render($request, $exception);
}
把异常打印出来:
No query results for model [App\Models\GiftPack].