Exemplo n.º 1
0
 /**
  * Created By Dara on 23/11/2015
  * accept the suggested friends the difference is the callback
  */
 public function suggestRequest(Request $request, FriendRepository $friendRepository)
 {
     $friend = User::findOrFail($request->input('profile'));
     $exist = $friendRepository->isFriend($friend->id);
     if (!$exist) {
         $friendRepository->makeFriend($friend);
         return ['hasCallback' => '1', 'callback' => 'friendSuggestRequest', 'hasMsg' => '1', 'msg' => trans('profile.friendRequestSent'), 'returns' => ['status' => 2]];
     } else {
         return ['hasCallback' => 0, 'callback' => '', 'hasMsg' => '1', 'msgType' => 'info', 'msg' => trans('profile.friendRequestDuplicated'), 'returns' => ''];
     }
 }
Exemplo n.º 2
0
 /**
  * Created by Emad Mirzaie on 06/10/2015.
  * Check if auth user is friend with user
  */
 public function getIsFriendAttribute()
 {
     $friendRepository = new FriendRepository();
     return $friendRepository->isFriend($this->attributes['id']);
 }