I'm working with Laravel 5 to do the following: I have a grid that shows all the clients that the company has, in each row of that grid, there is a button to select that client like this:
This button sends me to a separate screen that is related directly with the selected client, when this happens, the URL is as follows:
http://sistemaprueba.com/modulos?1
where the value after the question mark represents the value of the id of the selected client. Now, I need to save the value of that id in a variable to be able to use it later, how can I do that?
This is my grid:
<div class="row">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Nombre Cliente</th>
<th>Ingresar</th>
</tr>
</thead>
<tbody>
@foreach($results as $result)
<tr>
<td></td>
<td><a href="" class="btn-box-tool" ><i class="fas fa-sign-in-alt" aria-hidden="true"></i></a>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
This is the route to the new screem:
Route::get('/modulos', 'HomeController@modulos')->name('modulos');
and my controller looks like this:
class ClientController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function index()
{
$id = \Auth::user()->id;
$results = DB::table('clients')->join('clients_company', 'clients_company.fk_id_client', '=', 'client.id')
->where('clients_company.fk_id_usuar',$id)->get();
return view('clients',compact('results'));
}
public function modulos()
{
return view('modulos');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire