Home > Net >  redirect route with # laravel
redirect route with # laravel

Time:12-28

I use "return redirect()->route()" to routing but I have a tab named "#tab4" but cannot add this to url with redirect()->route. I want to show the same tab after submit but cannot set the url.when I use redirect()->back(), cannot see success message and page does not resresh. How to do that in laravel?

sessionsuccess("asdfghj.");

return  redirect()->route('manage.customers.detail', ['account' => $this->account->id]);

the url I want: http://localhost:8000/manage/customers/detail/9#tab4

CodePudding user response:

web.php on route

Route::view('/#detail', 'manage.customers.detail/{account_id}')->name('detail');

on controller

return  redirect()->route("detail")->with("account_id"=>$this->account_id);

Try this.I believe working this

CodePudding user response:

Try to use :

return redirect()->to(route('manage.customers.detail', ['account' => $this->account->id]).'#tab4');

CodePudding user response:

Store your current tab inside a session variable. after loading view, sessions can be used and retrieve your last tab

  • Related