Answer the question
In order to leave comments, you need to log in
How to fix Undefined variable: e?
when you click the subscribe button:
<a href="{{ route('user.follow', $user->id) }}">Follow</a>
Route::post('/sn/profile/{profileId}/follow', '[email protected]')->name('user.follow');
Route::post('/sn/profile/{profileId}/unfollow', '[email protected]')->name('user.unfollow');
public function followUser(int $profileId)
{
return redirect()->route('home');
}
public function unFollowUser(int $profileId)
{
$user = User::where('id', $profileId)->first();
if(!$user) {
return redirect()->back();
}
$user->followers()->detach(auth()->user()->id);
return redirect()->back();
}
Answer the question
In order to leave comments, you need to log in
switch ($exception->getStatusCode())
$this->renderHttpException($e)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question