Exemplo n.º 1
0
 public function getReceiverAttribute()
 {
     $user_id = $this->receiver_id;
     $company = Company::with('company_logo_detail')->where('user_id', '=', $user_id)->first();
     $data = [];
     $type = 'user';
     if (!empty($company)) {
         $data = $company;
         $type = 'employer';
     } else {
         $data = User::with('profile_image_detail')->where('id', '=', $user_id)->first();
     }
     return ['type' => $type, 'data' => $data];
 }
Exemplo n.º 2
0
 public function getAllUsers()
 {
     try {
         $company_ids = Company::lists('user_id');
         return User::with('profile_image_detail', 'profile_cover_detail')->whereNotIn('id', $company_ids)->get()->toArray();
     } catch (Exception $e) {
         return Response::json(['error' => $e->getMessage()]);
     }
 }