lgraba / Prty

A small Laravel application for me to play around with
1 stars 0 forks source link

Showing Friend Request Acceptance Link on Friends Page within userblocks #10

Closed lgraba closed 9 years ago

lgraba commented 9 years ago

I wanted to show an acceptance link on each userblock underneath the "Friend Requests" section on the Friends Index page. To avoid writing a new view just for friend-request userblocks, I added @if ($requested = true) @endif to the Friend Index page view. This takes advantage of Blade's if statement to set a variable called $requested to true for each userblock looped through and displayed for the Friend Requests section. I don't think this is proper, but it works for now. I would like to find a better way to do this. Perhaps compare the $user with the $requests array, if $requests is set, and put the link within this if statement?

lgraba commented 9 years ago

I created a few helper methods within the User class and used one of them here to run an if statement in the Friend Index page view.