Laravel (5) - Routing to controller with optional parameters -


i'd create route takes required id, , optional start , end dates ('ymd'). if dates omitted, fall default. (say last 30 days) , call controller....lets 'path@index'

route::get('/path/{id}/{start?}/{end?}', function($id, $start=null, $end=null) {     if(!$start)     {         //set start     }     if(!$end)     {         //set end     }      // syntax goes here call 'path@index' $id, $start, , $end? }); 

any appreciated. i'm sure there simple answer, couldn't find anywhere.

thanks in advance help!

there no way call controller route::get closure.

use route::get('/path/{id}/{start?}/{end?}', 'controller@index'); , handle parameters in controller function:

public function index($id, $start = null, $end = null) {     if (!start)         // set start      if (!end)         // set end      // other stuff }