Parameter passage laravel

1

How do I 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');
    
asked by anonymous 14.11.2017 / 16:48

2 answers

1

Use an associative array - see documentation .

route('transferir.edit', ['idservidor' => $destino->servidor->idservidor, 
                          'setor' => $destino->setor]);
    
14.11.2017 / 17:04
0

I do not know if I understand very well, but try:

route('transferir.edit', ['idservidor' => $destino->servidor->idservidor, 
                          'setor' => $destino->setor
                         ]);
    
14.11.2017 / 17:06