Reputation: 107
I have 4 tabs. When the information is updated and there is no error, I can display the same tab after returning. That's how I set the tab:
return redirect(route('frontend.user.account') . '#edit')->with(['tab' => 'edit']);
Now, suppose there's an error in the update. How can I specify my preferred tab, like the above code??
this is update function :
public function update(UpdateProfileRequest $request)
{
$output = $this->userRepository->update(
$request->user()->id,
$request->only('first_name', 'last_name', 'email','national_Code','phone_number','mobile_number','state','city','address','postal_code', 'avatar_type', 'avatar_location'),
$request->has('avatar_location') ? $request->file('avatar_location') : false
);
return redirect(route('frontend.user.account') . '#edit')->with(['tab' => 'edit']);
}
Upvotes: 1
Views: 626
Reputation: 151
The solution for us was to add the tab to the form action.
<form ... action="{{ url()->current() }}/tabname
Upvotes: 1