将一个url作为参数传递给Laravel应用程序

pass a url as parameter to Laravel app

Hi I need to pass a url as a parameter to a laravel route, but it gives me a 404 error. I tried to send the url as an encoded string and it's still not working. My code:

 var search = encodeURIComponent($('#links_search').val());

and the ajax call sent to

api/v1/clicks/p/'+page_num+'/'+search

I'm searching URL's in db, and the Laravel Route is defined as follows

Route::get('/clicks/p/{page?}/{search?}',
        [
           'as' => 'allClicksUrl',
           'uses' => 'ApiController@getAllClicks'
        ]);

Any suggestions to this requirement?