コード例 #1
0
 public function Fired($id, $get, $id_par, $id_emplo)
 {
     // Start Check Authorization
     /**
      * 1. FullAccess - 1
      * 2. HRD - 3
      * 3. Creator - 5
      * 4. Handler - 7
      */
     $invalid_auth = 1;
     $authRole = Auth::user()->UserRoles->role;
     if ($authRole == 7 or $authRole == 1 or $authRole == 3) {
         $invalid_auth = 0;
     }
     if ($invalid_auth == 1) {
         Alert::error('Anda tidak memilik akses ini')->persistent('close');
         return redirect('project/view/' . $id);
     }
     // End Check Authorization
     $now = date('Y-m-d');
     $gat = str_replace('_', ' ', $get);
     $got = ucfirst($gat);
     if ($get == 'admin') {
         $admin = Admin::find($id_par);
         $admin->status = 0;
         $admin->end = $now;
         $admin->save();
     } elseif ($get == 'project_officer') {
         $po = ProjectOfficer::find($id_par);
         $po->status = 0;
         $po->end = $now;
         $po->save();
     } elseif ($get == 'teamleader') {
         $po = Teamleader::find($id_par);
         $po->status = 0;
         $po->end = $now;
         $po->save();
     }
     $emplo = Employee::find($id_emplo);
     $emplo->status = 0;
     $emplo->save();
     Alert::success('Sukses memberhentikan ' . $got)->persistent("Close");
     return redirect('project/view/' . $id);
 }
コード例 #2
0
 public function Fired($id, $get, $id_par, $id_emplo)
 {
     $now = date('Y-m-d');
     $gat = str_replace('_', ' ', $get);
     $got = ucfirst($gat);
     if ($get == 'admin') {
         $admin = Admin::find($id_par);
         $admin->status = 0;
         $admin->end = $now;
         $admin->save();
     } elseif ($get == 'project_officer') {
         $po = ProjectOfficer::find($id_par);
         $po->status = 0;
         $po->end = $now;
         $po->save();
     } elseif ($get == 'teamleader') {
         $po = Teamleader::find($id_par);
         $po->status = 0;
         $po->end = $now;
         $po->save();
     }
     $emplo = Employee::find($id_emplo);
     $emplo->status = 0;
     $emplo->save();
     Alert::success('Sukses memberhentikan ' . $got)->persistent("Close");
     return redirect('project/view/' . $id);
 }