I'm using Laravel 5.6 with Resource Controller. My show method:
public function show(Artigo $artigo)
{
$artigo = $artigo->first();
return view('painel.revista.detalhes', compact('artigo'));
}
Would it be possible to ignore the line $artigo = $artigo->first();
and pass the variable directly to the view? I tried:
public function show(Artigo $artigo)
{
return view('painel.revista.detalhes', compact('artigo'));
}
However, I was unable to access the data in the view, I tried: {{ $artigo->titulo }}
but it did not work.
A collection Item was included as a parameter when running:
php artisan make:controller ConteudoController -m Models/Artigo