i'm trying to use the method 'show' in a controller but when it return a empty object.
Since this view:
@foreach ($usuarios as $usuario2)
<h2>{{$usuario2->nombre}}</h2>
<a href="prurequests/{{$usuario2->id}}">ver mas2...</a>
@endforeach
Through tis route:
Route::resource('/prurequests','PruebasControllers\PrurequestsController');
To this controller's method:
public function show(Usuario2 $usuario2) // Ruta con implicing biding
{
return $usuario2;
}
This is the model:
class Usuario2 extends Model
{
Protected $fillable = ['nombre'];
}
I tried with this and it works
View:
@foreach ($usuarios as $usuario2)
<h2>{{$usuario2->nombre}}</h2>
<a href="impli/{{$usuario2->id}}">ver mas...</a>
<a href="prurequests/{{$usuario2->id}}">ver mas2...</a>
@endforeach
Route
Route::get('impli/{usuario2}', function
(fractalwebpage\PruebasModelos\Usuario2 $usuario2) {
return $usuario2;
});
It bring me tha data ubt i had to put the nae of the model in the route and. e need to do it but Through the controller.