vendredi 13 novembre 2020

Laravel, only first element of array passed to route is readable

From a blade template I want to pass an array with a variable amount of values to a route, as described in the answer here.

However when I do this I can only ever access the first value in the array I pass to the route.

This is how I call the route in the blade template:


this is my route from web.php:

Route::get('stats/downloads', 'StatsController@view_stats_downloads')->name('stats.downloads');

and my controller:

public function view_stats_downloads(Request $request){
    // get the input parameters
    $group_by = $request->get('group_by');
    $stat_kind = $request->get('stat_kind');
    $company = $request->get('group_by');
    $user = $request->get('user');
    $start = $request->get('start');
    $end = $request->get('end');
    
    ...

The problem is, that I can only ever access the first value of the array I pass to the controller (stat_kind in this case). It doesn't natter in which order I call the get() function either.

What can I do to fix this?

I'm running laravel 5



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire