'determine url parameter in Laravel
I am new to Laravel an have a question.
I have controller named ReportsArchiveController
and function named loadReport in it.
this is what the method get
public static function loadReport(Request $request, $id, $view = 'reports.archive.single', $user_id = null)
this is the rout:
Route::get('/archive/{id}', ['as' => 'reports.archive.view', 'uses' => 'ReportsArchiveController@loadReport']);
I want to create new route that will use this method, and ask from where the user entered.
Route::get('/archive/{id}/csv', ['as' => 'reports.archive.view', 'uses' => 'ReportsArchiveController@loadReport']);
and ask in the method load report if the url is from /archive/{id}/csv or from /archive/{id}.
what I should add to the loadreport method to know if the user is from the url with csv or without? what to add to the method parameters? using Laravel 7
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
