in web.php
Route::get('/', function () {
return view('main');
})->name('main'); // i have 'name' route
in PostComponent.php
function mount( Request $request) {
$this->post_cat_id = $request->post_cat_id;
if( ! $this->post_cat_id){
return $this->redirect('/'); // fail
return $this->redirect()->route('main') ; // fail
return redirect()->route('main') ; // fail
return redirect()->to('/'); // fail
}
}
All goes failed.
How can I redirect in mount function ?
I just used Request class for getting query string from url
function mount( Request $request) {
}
Thanks.