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