コード例 #1
0
 /**
  * Overwrite the parent boot method
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     PrintingPassSheet::creating(function ($printing_pass_sheet) {
         $printing_pass_sheet->created_by = Auth::user()->id;
         $printing_pass_sheet->updated_by = Auth::user()->id;
     });
     PrintingLogSheet::updating(function ($printing_pass_sheet) {
         $printing_pass_sheet->updated_by = Auth::user()->id;
     });
 }
コード例 #2
0
 /**
  * Store a log sheet from the request
  *
  * @param Requests\StorePrintingPassSheetFromRequest $request
  * @param JobCard $job_card
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(StorePrintingPassSheetFromRequest $request, JobCard $job_card)
 {
     $this->authorize('pass_printing_job');
     if (isset($job_card->printingPassSheet) && $job_card->printingPassSheet->count() > 0) {
         return redirect()->action('PrintingPassSheetsController@edit', [$job_card]);
     }
     $passSheet = PrintingPassSheet::create(['material_grade_id' => $request->material_grade_id, 'material_thickness' => $request->material_thickness, 'material_width' => $request->material_width, 'treatment_side' => $request->treatment_side, 'adhesion_checked' => $request->adhesion_checked, 'register_checked' => $request->register_checked, 'blade_lines_checked' => $request->blade_lines_checked, 'dot_skipping_checked' => $request->dot_skipping_checked, 'slur_checked' => $request->slur_checked, 'note' => $request->note, 'unwind_drawing_id' => $request->unwind_drawing_id]);
     foreach ($request->sequence as $key => $value) {
         $station = PrintingPassSheetStation::create(['sequence' => $request->sequence[$key], 'inks_id' => $request->inks_id[$key], 'delta_e' => $request->delta_e[$key]]);
         $passSheet->stations()->save($station);
     }
     $job_card->printingPassSheet()->save($passSheet);
     flash()->success('Created', 'Printing pass sheet has been created.');
     return redirect()->action('PrintingPassSheetsController@edit', [$job_card]);
 }