1 | <?php |
||
19 | class Warehouse extends Eloquent\Model |
||
20 | { |
||
21 | use Eloquent\SoftDeletes; |
||
22 | |||
23 | /** |
||
24 | * We do not want any timestamps. |
||
25 | * |
||
26 | * @var bool |
||
27 | */ |
||
28 | public $timestamps = false; |
||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $dates = ['deleted_at']; |
||
33 | /** |
||
34 | * The attributes that are mass assignable. |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $fillable = ['name']; |
||
39 | |||
40 | 11 | public static function boot() |
|
48 | |||
49 | /** |
||
50 | * Guitars in the warehouse. |
||
51 | * |
||
52 | * @return Eloquent\Relations\HasManyThrough |
||
53 | */ |
||
54 | public function guitars() |
||
58 | |||
59 | /** |
||
60 | * Add racks to the warehouse. |
||
61 | * |
||
62 | * @param Eloquent\Collection|array $racks |
||
63 | * |
||
64 | * @return $this |
||
65 | */ |
||
66 | 2 | public function addRacks($racks) |
|
74 | |||
75 | /** |
||
76 | * Add rack to the warehouse. |
||
77 | * |
||
78 | * @param array|Rack $rack |
||
79 | * |
||
80 | * @return Eloquent\Model |
||
81 | */ |
||
82 | 4 | public function addRack($rack) |
|
91 | |||
92 | /** |
||
93 | * Racks in the warehouse. |
||
94 | * |
||
95 | * @return Eloquent\Relations\HasMany |
||
96 | */ |
||
97 | 6 | public function racks() |
|
101 | |||
102 | /** |
||
103 | * Remove racks using ids. |
||
104 | * |
||
105 | * @param $ids |
||
106 | * |
||
107 | * @return $this |
||
108 | */ |
||
109 | 1 | public function removeRacksNotIn($ids) |
|
115 | |||
116 | /** |
||
117 | * Add or update the racks. |
||
118 | * |
||
119 | * @param $racks |
||
120 | * |
||
121 | * @return $this |
||
122 | */ |
||
123 | public function addOrUpdateRacks($racks) |
||
131 | |||
132 | /** |
||
133 | * Add or Update Racks. |
||
134 | * |
||
135 | * @param $rack |
||
136 | * |
||
137 | * @return $this |
||
138 | */ |
||
139 | 2 | public function addOrUpdateRack($rack) |
|
146 | } |
||
147 |