1 | <?php |
||
2 | |||
3 | namespace App\Models; |
||
4 | |||
5 | use Backpack\CRUD\app\Models\Traits\CrudTrait; |
||
6 | use Illuminate\Database\Eloquent\Model; |
||
7 | |||
8 | /** |
||
9 | * @mixin IdeHelperCoupon |
||
10 | */ |
||
11 | class Coupon extends Model |
||
12 | { |
||
13 | use CrudTrait; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
14 | |||
15 | protected $guarded = ['id']; |
||
16 | |||
17 | /* |
||
18 | |-------------------------------------------------------------------------- |
||
19 | | FUNCTIONS |
||
20 | |-------------------------------------------------------------------------- |
||
21 | */ |
||
22 | |||
23 | /* |
||
24 | |-------------------------------------------------------------------------- |
||
25 | | RELATIONS |
||
26 | |-------------------------------------------------------------------------- |
||
27 | */ |
||
28 | |||
29 | /* |
||
30 | |-------------------------------------------------------------------------- |
||
31 | | SCOPES |
||
32 | |-------------------------------------------------------------------------- |
||
33 | */ |
||
34 | |||
35 | /* |
||
36 | |-------------------------------------------------------------------------- |
||
37 | | ACCESORS |
||
38 | |-------------------------------------------------------------------------- |
||
39 | */ |
||
40 | |||
41 | public function getPriceAttribute($value) |
||
42 | { |
||
43 | return $value / 100; |
||
44 | } |
||
45 | |||
46 | /* |
||
47 | |-------------------------------------------------------------------------- |
||
48 | | MUTATORS |
||
49 | |-------------------------------------------------------------------------- |
||
50 | */ |
||
51 | |||
52 | public function setPriceAttribute($value) |
||
53 | { |
||
54 | $this->attributes['price'] = $value * 100; |
||
55 | } |
||
56 | } |
||
57 |