が見つからないルートモデルは、結合のためのカスタムビュー、これは簡単なものでなければなりません。私のルートモデルがちょうど結合するとき はどのようにレンダリングされるようにカスタムビューを定義することができます指定されたIDを見つけることができませんか?ここでLaravel 5.4:私はLaravelでbegginingていたようID
は私のルートです:
Route::get('/empresa/edit/{empresa}', '[email protected]');
は、ここに私のコントローラのメソッドです:
public function edit(Empresa $empresa)
{
if ((!isset($empresa)) || ($empresa == null)):
//I get that this won't work...
return 'Empresa não encontrada';
endif;
return view('Empresa.dadosEmpresa')->with('empresa', $empresa)->with('action', URL::route('empresa_update', ['id', $empresa->id]))->with('method', 'PATCH');
}
はここでエラーハンドラを使用するには、私の "試み" です:
これはどのようにpublic function render($request, Exception $exception)
{
if ($e instanceof ModelNotFoundException)
{
//this is just giving me a completely blank response page
return 'Empresa não encontrada';
}
return parent::render($request, $exception);
}
本当にやった?