public function destroy($id) { $issues = Issue::where('registration_id', '=', $id)->delete(); $placements = Placement::where('registration_id', '=', $id)->delete(); $receivables = Receivable::where('registration_id', '=', $id)->get(); foreach ($receivables as $receivable) { $installments = Installment::where('receivable_id', '=', $receivable->id)->get(); foreach ($installments as $installment) { $earnings = Earning::where('earnable_type', '=', 'Installment')->where('earnable_id', '=', $installment->id)->get(); foreach ($earnings as $earning) { $earning->delete(); } $installment->delete(); } $earnings = Earning::where('earnable_type', '=', 'Receivable')->where('earnable_id', '=', $receivable->id)->delete(); $reductions = Reduction::where('receivable_id', '=', $receivable->id)->delete(); $receivable->delete(); } Registration::destroy($id); Session::flash('message', 'Sukses membatalkan Pendaftaran!, Semua Data terkait pendaftaran ini telah dihapus!'); }
public function showDashboard() { $menu = ''; $_301 = Issue::where('generation_id', '=', 1)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_201 = Issue::where('generation_id', '=', 2)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_101 = Issue::where('generation_id', '=', 3)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_302 = Issue::where('generation_id', '=', 4)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_202 = Issue::where('generation_id', '=', 5)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_102 = Issue::where('generation_id', '=', 6)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_603 = Issue::where('generation_id', '=', 7)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_503 = Issue::where('generation_id', '=', 8)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $_403 = Issue::where('generation_id', '=', 9)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $last_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '<>', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count(); $curr_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '=', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count(); $movement_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 10)->count(); $curr_active_students = Placement::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('active', '=', 1)->count(); $curr_do_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 13)->count(); $curr_resign_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 14)->count(); $curr_relocate_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 15)->count(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); return View::make('dashboard.home', compact('_301', '_201', '_101', '_302', '_202', '_102', '_603', '_503', '_403', 'last_month_registrations', 'curr_month_registrations', 'movement_registrations', 'curr_active_students', 'curr_do_students', 'curr_resign_students', 'curr_relocate_students', 'courses', 'menu')); }
public function normalizeIssue() { $issues = Issue::all(); foreach ($issues as $issue) { // Normalize Educations $educations = Education::where('student_id', '=', $issue->student_id)->get(); foreach ($educations as $education) { $education->student_id = $issue->id; $education->save(); } // Normalize Placements $placements = Placement::where('student_id', '=', $issue->student_id)->get(); foreach ($placements as $placement) { $placement->student_id = $issue->id; $placement->save(); } // Normalize Receivables $receivables = Receivable::where('student_id', '=', $issue->student_id)->get(); foreach ($receivables as $receivable) { $receivable->student_id = $issue->id; $receivable->save(); } } }
public function destroy($id) { $movement = Movement::find($id); $issue_id = $movement->issue_id; $base_id = $movement->base_id; $destination_id = $movement->destination_id; // restore the placement $placement = Placement::where('issue_id', '=', $issue_id)->where('course_id', '=', $destination_id)->first(); if ($placement) { $placement->course_id = $base_id; $placement->save(); } // deleting earning $earning = Earning::where('earnable_type', '=', 'Movement')->where('earnable_id', '=', $id)->first(); if ($earning) { $earning->delete(); } Movement::destroy($id); // Store to Timelines }
public function destroy($id) { $resign = Resign::find($id); $placements = Placement::where('resign_id', '=', $id)->get(); foreach ($placements as $placement) { $placement->resign_id = 0; $placement->active = 1; $placement->save(); } Returnment::where('resign_id', '=', $id)->delete(); Earning::where('earnable_type', '=', 'Resign')->where('earnable_id', '=', $id)->delete(); Resign::destroy($id); Session::flash('message', 'Sukses membatalkan penon-aktifan siswa'); }