2
As step 2 or more variables on the route?
View
<a href="{{route('transferir.edit', [$destino->servidor->idservidor, $destino->setor])}}" class="btn btn-default btn-xs" role="button"><span class="glyphicon glyphicon-refresh"></span>Transferir</a>
Controller
public function edit($idservidor, $setorusuario)
{
$servidor = Servidor::findOrFail($idservidor);
$cargos = Cargo::orderBy('cargo')->pluck('cargo', 'idcargo');
$setors = Setor::orderBy('setor')->pluck('setor', 'idsetor');
return view('transferir.edit', compact('servidor','cargos','setors','setorusuario'));
}
Route
Route::resource('/transferir', 'TransferirController');
Route::get('/transferir/{idservidor}/{setor}', 'TransferirController@edit');
Hey, young man. You got it right?
– Jéf Bueno
Returns this error Type error: Too few Arguments to Function App Http Controllers Transferircontroller::Edit(), 1 passed and Exactly 2 expected
– Juliano
But you used what was suggested in the reply?
– Jéf Bueno
Yes, the url looks like this http://localhost:8000/download/7882/Edit? sector=CAD Weird.
– Juliano
Are you sure you used exactly the same? Notice that I edited and switched
idServidor
foridservidor
.– Jéf Bueno
I solved using its solution in the view and changing in the controller the function public Function Edit(request $sector, $idserver) ː }
– Juliano