Example #1
0
 /**
  * Overwrite the parent boot method
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     PrintingLogEntry::creating(function ($printing_log_entry) {
         $printing_log_entry->created_by = Auth::user()->id;
         $printing_log_entry->updated_by = Auth::user()->id;
     });
     PrintingLogEntry::updating(function ($printing_log_entry) {
         $printing_log_entry->updated_by = Auth::user()->id;
     });
 }
Example #2
0
 /**
  * Return a collection of printing log entries
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function printingLogEntries()
 {
     $printingLogSheetIds = $this->printingLogSheets->pluck('id')->toArray();
     $printingLogEntriesArray = DB::table('printing_log_entries')->whereIn('printing_log_sheets_id', $printingLogSheetIds)->get();
     return PrintingLogEntry::hydrate($printingLogEntriesArray);
 }
 /**
  * @test
  */
 public function it_has_a_statically_callable_table_name()
 {
     $tableName = App\Models\PrintingLogEntry::table();
     $this->assertEquals('printing_log_entries', $tableName);
 }