jeudi 1 février 2018

Laravel: Why does function parameter change to empty array

I have a function that accepts some optional parameters used to filter some data for reports. For some reason, my optional dates changed into empty arrays when I added a third optional User parameter (implicit binding). Why is that?

//Route File
Route::get('reports/{start}/{end}/{user?}', 'ReportsController@index');
Route::get('reports','ReportsController@index');

//ReportController
public function index($start_time = null, $end_time = null) {
    // $start_time = null;
}

public function index($start_time = null, $end_time = null, User $user = null) {
    // $start_time = [];
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire