What do you want to achieve?
Inside your import method you can get mode like this
$mode = $request->query('mode');
Documentation: https://laravel.com/docs/7.x/requests#retrieving-input
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi all,
So the way that I currently have things, is that I'm calling it as /test/import
Route::get('test/import', [ 'as' => 'test.import', 'uses' => 'TestController@import' ]);
Which pulls in the correct import method inside TestController..
Here is what I'm trying to achieve:
How can I make it
test/import/?mode=test1 or test/import/?mode=test2 that calls on different methods depending on the mode query string
@sema314 Like this?
public function import() {
$mode = $request->query('mode', 'update');
$this->update($mode);
}
public function update($mode) {
// your code
}
Second parameter of ->query() is default.
Please or to participate in this conversation.