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