public function getDeleteApplication($id)
 {
     DB::beginTransaction();
     Application::where('id', $id)->delete();
     Administrative::where('registrant_id', $id)->delete();
     Technical::where('registrant_id', $id)->delete();
     DB::commit();
 }
Exemple #2
0
 public function getHackersWithRating()
 {
     $hackers = [];
     foreach (Application::where("team_id", $this->id)->get() as $app) {
         $hacker = User::with('application', 'application.ratings', 'application.school')->find($app->user_id);
         $hacker['application']['ratinginfo'] = $hacker->application->ratingInfo();
         $hackers[] = $hacker;
     }
     return $hackers;
 }
 /**
  * Update the user's application form.
  *
  * @param ApplicationRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(ApplicationRequest $request)
 {
     if ($request->has('id')) {
         $application = Application::where('id', $request->has('id'))->first();
         if ($application->status != 'PENDING') {
             return redirect()->back()->with(['notice' => Lang::get('user.application_stop_edit')]);
         }
         if ($application->user_id == Auth::user()->id) {
             $this->repository->update($request->all());
             return redirect()->route('user.account')->with(['notice' => Lang::get('user.application_updated')]);
         }
         return redirect()->back()->with(['notice' => Lang::get('user.application_cannot_edit')]);
     }
     return redirect()->back()->with(['notice' => Lang::get('user.application_cannot_edit')]);
 }
 public function getMentorsPrint(Request $request)
 {
     $applications = Application::where('status', "accepted")->orderBy('name')->get();
     $mentors = Mentor::orderBy('name')->get();
     return view('print.mentors', compact('applications', 'mentors'));
 }
 public function leaveCurrentTeam()
 {
     $app = self::getApplication()['application'];
     $old_team_id = $app->team_id;
     $app->team_id = null;
     $app->save();
     if (Application::where("team_id", $old_team_id)->get()->count() == 0) {
         //we don't want empty teams
         Team::find($old_team_id)->delete();
     }
     return ['ok'];
 }
 /**
  * Update an application form.
  *
  * @param array $attributes
  * @return mixed
  */
 public function update($attributes = array())
 {
     Application::where('id', $attributes['id'])->first()->update($attributes);
 }