1 | <?php |
||
19 | class Service extends EloquentModel |
||
20 | { |
||
21 | /** |
||
22 | * The attributes that are mass assignable. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $fillable = [ |
||
27 | 'name', |
||
28 | 'business_id', |
||
29 | 'description', |
||
30 | 'prerequisites', |
||
31 | 'duration', |
||
32 | 'type_id', |
||
33 | 'color' |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * The attributes that aren't mass assignable. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $guarded = ['id', 'slug']; |
||
42 | |||
43 | /** |
||
44 | * Belongs to service type. |
||
45 | * |
||
46 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo Relationship Service belongs to type query |
||
47 | */ |
||
48 | 3 | public function type() |
|
52 | |||
53 | /** |
||
54 | * Get service type name. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | 2 | public function getTypeNameAttribute() |
|
66 | |||
67 | /** |
||
68 | * belongs to Business. |
||
69 | * |
||
70 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo Relationship Service belongs to Business query |
||
71 | */ |
||
72 | 3 | public function business() |
|
76 | |||
77 | /** |
||
78 | * TODO: Check slug setting can be moved to a more proper place. |
||
79 | * |
||
80 | * Save the model to the database. |
||
81 | * |
||
82 | * @param array $options |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | 75 | public function save(array $options = []) |
|
92 | |||
93 | ////////////// |
||
94 | // Mutators // |
||
95 | ////////////// |
||
96 | |||
97 | /** |
||
98 | * set Duration Attribute. |
||
99 | * |
||
100 | * @param int $duration |
||
101 | */ |
||
102 | 75 | public function setDurationAttribute($duration) |
|
106 | |||
107 | //////////// |
||
108 | // Scopes // |
||
109 | //////////// |
||
110 | |||
111 | /** |
||
112 | * Scope Slug. |
||
113 | * |
||
114 | * @param Illuminate\Database\Query $query |
||
115 | * @param string $slug Slug of the desired Service |
||
116 | * |
||
117 | * @return Illuminate\Database\Query Scoped query |
||
118 | */ |
||
119 | 1 | public function scopeSlug($query, $slug) |
|
123 | } |
||
124 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.