B
B
BonBon Slick2017-08-08 16:22:58
Laravel
BonBon Slick, 2017-08-08 16:22:58

Pass link via GET request to controller?

Example:

https://steamcommunity.com/linkfilter/?url=https://soundcloud.com

My code:
Route::get('linkfilter/{link}', '[email protected]')->name('linkfilter_page');
 public function linkfilter($link)
    {
        $link = (string)trim(Helpers::codeClear($link));
       ...
    }

However, it does not reach the controller, it throws an error
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
No message

Apparently it considers this as its own URL, and not a parameter.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Melikhov, 2017-08-08
@BonBonSlick

If you are passing a url as a query (the part after the ?) parameter, then you need to make the route look like this
And your url will be available via Request

public function linkfilter(Request $request)
{
     $link = (string)trim(Helpers::codeClear($request->url));
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question