Without further ado, just upload the code!
@if ($user->id !== Auth::user()->id) <div > @if (Auth::user()->isFollowing($user->id)) <form action="{{ route('', $user->id) }}" method="post"> {{ csrf_field() }} {{ method_field('DELETE') }} <button type="submit" class="btn btn-sm">Unfollow</button> </form> @else <form action="{{ route('', $user->id) }}" method="post"> {{ csrf_field() }} <button type="submit" class="btn btn-sm btn-primary">focus on</button> </form> @endif </div> @endif
Implemented by displaying different views.
The above example of whether to pay attention to the implementation in Laravel is all the content I have shared with you. I hope you can give you a reference and I hope you can support me more.