Exemple #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];
 }
Exemple #2
0
 public function getAllCompanies()
 {
     try {
         return Company::with('company_logo_detail', 'company_cover_detail', 'user', 'company_video_detail')->get()->toArray();
     } catch (Exception $e) {
         return Response::json(['error' => $e->getMessage()]);
     }
 }