Thursday, March 2, 2017

How to handle if the parameter is in url is empty laravel

I have a Route

/first/second/{param}, 'IndexController@index'

And in controller

public function index($param)
{
    $param = trim($param);
    if($param == "")
    {
        redirect()->back();
    }
}

I have tried to handle it but failed. When ever I send /first/second/ if gives error of RouteCollection. How can I control it?




via Alen

Advertisement