public function getApplications(LoggedInRequest $request)
 {
     $applications = Application::orderBy('applicationEdited', "desc")->get();
     $numInterviewed = count(Application::where('interviewed', true)->get());
     $numAccepted = count(Application::where('status', 'Accepted')->get());
     $numReviewed = count(Application::where('reviewed', true)->get());
     return view('pages.applications', compact('applications', 'numInterviewed', 'numAccepted', 'numReviewed'));
 }
Example #2
0
 public function getNextApplicationID()
 {
     $user = Auth::user();
     foreach (Application::orderBy(DB::raw('RAND()'))->get() as $app) {
         //we must find the applications that are completed and have fewer than 3 reviews and that i didn't review
         if ($app->completed) {
             if ($app->reviews < 3) {
                 if (!ApplicationRating::where('application_id', $app->id)->where('user_id', $user->id)->first()) {
                     return $app->id;
                 }
             }
         }
     }
     return null;
 }