public function passJob(Request $request, LaminatingLogSheet $laminating_log_sheet)
 {
     $this->authorize('pass_laminating_job');
     //
     $this->validate($request, ['designation' => 'required|in:operator,manager']);
     $laminating_log_sheet->passBy($request->get('designation'), Auth::user());
     flash()->success('Passed by ' . $request->get('designation'), 'The log sheet has been updated.');
     return redirect()->action('LaminatingLogSheetsController@edit', [$laminating_log_sheet]);
 }
 /**
  * Overwrite the parent boot method
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     LaminatingLogSheet::creating(function ($laminatingLogSheet) {
         $laminatingLogSheet->created_by = \Auth::user()->id;
         $laminatingLogSheet->updated_by = \Auth::user()->id;
     });
     LaminatingLogSheet::updating(function ($laminatingLogSheet) {
         $laminatingLogSheet->updated_by = \Auth::user()->id;
     });
 }
 /**
  * Jobs started in the current shift
  * @return mixed
  */
 public function currentShiftJobsStarted()
 {
     $jobsStartedIds = DB::table(LaminatingLogSheet::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);
 }