private function generateCode() { $returnments = Returnment::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count(); $returnments += 1; $code = Auth::user()->curr_project->code . Auth::user()->location->code . '99' . $returnments; return $code; }
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'); }