Is There A Better Way?

Posted 4 years ago by MarkMatute

So i have a friendship system here and this is my code for retrieving all users and defining id Add Friend, Request Sent, or Unfriend @if(count(Auth::user()->friends)==0) Add Friend @else @foreach(Auth::user()->friends as $f) @if($f->id==$u->id) @if($f->is_friend) Unfriend @else Cancel Request @endif @else Add Friend @endif @endforeach @endif

Please sign in or create an account to participate in this conversation.