Conditions | 2 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | protected static function boot() |
||
28 | { |
||
29 | parent::boot(); |
||
30 | static::addGlobalScope(new BillScope()); |
||
31 | static::creating(function ($model) { |
||
32 | /** |
||
33 | * @var \Illuminate\Database\Eloquent\Model $model |
||
34 | */ |
||
35 | if (!$model->getKey()) { |
||
36 | $model->{$model->getKeyName()} = Str::uuid()->toString(); |
||
37 | } |
||
38 | |||
39 | $model->total = 0; |
||
40 | $model->tax = 0; |
||
41 | $model->discount = 0; |
||
42 | $model->is_bill = true; |
||
43 | $model->currency = config('soap.invoices.default_currency', 'THB'); |
||
44 | $model->status = config('soap.invoices.default_status', 'concept'); |
||
45 | $model->reference = InvoiceReferenceGenerator::generate(); |
||
46 | }); |
||
49 |