1 | <?php |
||
36 | class Rate extends Model implements RateContract |
||
37 | { |
||
38 | use ValidatingTrait; |
||
39 | use CacheableEloquent; |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | protected $fillable = [ |
||
45 | 'resource_id', |
||
46 | 'resource_type', |
||
47 | 'percentage', |
||
48 | 'operator', |
||
49 | 'amount', |
||
50 | ]; |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | protected $casts = [ |
||
56 | 'resource_id' => 'integer', |
||
57 | 'resource_type' => 'string', |
||
58 | 'percentage' => 'float', |
||
59 | 'operator' => 'string', |
||
60 | 'amount' => 'integer', |
||
61 | ]; |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | protected $observables = [ |
||
67 | 'validating', |
||
68 | 'validated', |
||
69 | ]; |
||
70 | |||
71 | /** |
||
72 | * The default rules that the model will validate against. |
||
73 | * |
||
74 | * @var array |
||
75 | */ |
||
76 | protected $rules = []; |
||
77 | |||
78 | /** |
||
79 | * Whether the model should throw a |
||
80 | * ValidationException if it fails validation. |
||
81 | * |
||
82 | * @var bool |
||
83 | */ |
||
84 | protected $throwValidationExceptions = true; |
||
85 | |||
86 | /** |
||
87 | * Create a new Eloquent model instance. |
||
88 | * |
||
89 | * @param array $attributes |
||
90 | */ |
||
91 | public function __construct(array $attributes = []) |
||
104 | |||
105 | /** |
||
106 | * Get the owning resource model. |
||
107 | * |
||
108 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
109 | */ |
||
110 | public function resource(): MorphTo |
||
114 | } |
||
115 |