Compare commits
No commits in common. "90ef3c9c29c99c115475e27ba337d484e6059d60" and "e4899de42a3aa9b1a44e123c89d6afc668b8bd7a" have entirely different histories.
90ef3c9c29
...
e4899de42a
@ -30,8 +30,17 @@ 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user