Compare commits
2 Commits
e4899de42a
...
90ef3c9c29
Author | SHA1 | Date | |
---|---|---|---|
90ef3c9c29 | |||
0b359b7255 |
@ -30,17 +30,8 @@ public static function boot(): void
|
|||||||
|
|
||||||
static::created(function ($model) {
|
static::created(function ($model) {
|
||||||
$model->attributes['internal_id'] = 'TN-INR-'.$model->id;
|
$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();
|
$model->save();
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo: sync all invoices within time and customer constraints
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function customer(): BelongsTo
|
public function customer(): BelongsTo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user