Example #1
0
 /**
  * Determine number of times the application has been reviewed
  */
 public function getReviewsAttribute()
 {
     return ApplicationRating::where('application_id', $this->id)->get()->count();
 }
Example #2
0
 public function getApplication($id)
 {
     $user = Auth::user();
     if (!Auth::user()->hasRole('exec')) {
         //TODO middleware perhaps?
         return;
     }
     $app = Application::with('user', 'school', 'team', 'notes.user')->find($id);
     $app->resumeURL = GeneralController::resumeUrl($app->user->id, 'get');
     $app->myrating = ApplicationRating::where('application_id', $id)->where('user_id', $user->id)->first();
     $app->github_summary = $app->getGithubSummary();
     return $app;
 }