Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel optional params

//Use Route::get('/path/{id}/{start?}/{end?}', 'Controller@index'); 
//and handle the parameters in the controller function:

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

    if (!$end) {
        // set end
    }

    // do other stuff
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #optional #params
ADD COMMENT
Topic
Name
7+4 =