lundi 9 décembre 2019

[Laravel][Routing] How to pass param to controller respective with route parameter

I met a problem, although i searched many places but could not find the answer. So, i ask here for a support. I want to pass param into controller function that respective with param in route. Please see below example: I want these routes to Check controller , function getByTime($time)

Route::get('/hourly', 'Check@getByTime');
Route::get('/daily', 'Check@getByTime');
Route::get('/weekly', 'Check@getByTime');

class Check {
    function getByTime($time) {}
}

Example conditions:

hourly: $time=1
daily: $time=24
weekly: $time = 24*7

I mean like this:

Route::get('/hourly', 'Check@getByTime(1)');
Route::get('/daily', 'Check@getByTime(24)');
Route::get('/weekly', 'Check@getByTime(168)');

Please help me to resolve it. Sorry for my bad explanation, and thanks for your help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire