Compare commits

...

2 Commits

View File

@ -30,17 +30,8 @@ public static function boot(): void
static::created(function ($model) {
$model->attributes['internal_id'] = 'TN-INR-'.$model->id;
$invoices = Invoice::whereBetween('date', [$model->date_start, $model->date_end])
->where('customer_id', $model->customer_id)->get()->pluck('id')->toArray();
$model->invoices()->sync($invoices);
$model->save();
});
// todo: sync all invoices within time and customer constraints
}
public function customer(): BelongsTo