/**
  * Pass the job by the designated person
  * @param Request $request
  * @param SlittingLogSheet $slitting_log_sheet
  * @return \Illuminate\Http\RedirectResponse
  */
 public function passJob(Request $request, SlittingLogSheet $slitting_log_sheet)
 {
     $this->authorize('pass_slitting_job');
     //
     $this->validate($request, ['designation' => 'required|in:operator,manager']);
     $slitting_log_sheet->passBy($request->get('designation'), Auth::user());
     flash()->success('Passed by ' . $request->get('designation'), 'The log sheet has been updated.');
     return redirect()->action('SlittingLogSheetsController@edit', [$slitting_log_sheet]);
 }
Ejemplo n.º 2
0
 /**
  * Overwrite the parent boot method
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     SlittingLogSheet::creating(function ($slittingLogSheet) {
         $slittingLogSheet->created_by = \Auth::user()->id;
         $slittingLogSheet->updated_by = \Auth::user()->id;
     });
     SlittingLogSheet::updating(function ($slittingLogSheet) {
         $slittingLogSheet->updated_by = \Auth::user()->id;
     });
 }
Ejemplo n.º 3
0
 /**
  * Jobs started in the current shift
  * @return mixed
  */
 public function currentShiftJobsStarted()
 {
     $jobsStartedIds = DB::table(SlittingLogSheet::table())->select('job_cards_id')->groupBy('job_cards_id')->havingRaw('min(created_at) >= \'' . $this->current_shift->starting_time . '\'')->havingRaw('min(created_at) <= \'' . $this->current_shift->ending_time . '\'')->pluck('job_id_fk');
     return JobCard::find($jobsStartedIds);
 }