1 | <?php |
||
18 | abstract class Component implements |
||
19 | ComponentInterface, |
||
20 | WithNavigation |
||
21 | { |
||
22 | use HasAccess, HasEvents, HasNavigation; |
||
23 | |||
24 | /** |
||
25 | * @var |
||
26 | */ |
||
27 | protected $name; |
||
28 | |||
29 | /** |
||
30 | * @var \Illuminate\Foundation\Application |
||
31 | */ |
||
32 | protected $app; |
||
33 | |||
34 | protected $title; |
||
35 | |||
36 | /** |
||
37 | * @var mixed|\Sco\Admin\Contracts\RepositoryInterface |
||
38 | */ |
||
39 | protected $repository; |
||
40 | |||
41 | /** |
||
42 | * @var \Illuminate\Database\Eloquent\Model |
||
43 | */ |
||
44 | protected $model; |
||
45 | |||
46 | protected static $booted = []; |
||
47 | |||
48 | /** |
||
49 | * @var \Illuminate\Contracts\Events\Dispatcher |
||
50 | */ |
||
51 | protected static $dispatcher; |
||
52 | |||
53 | public function __construct(Application $app, $modelClass) |
||
67 | |||
68 | protected function setDefaultName() |
||
72 | |||
73 | protected function getModelClassName() |
||
83 | |||
84 | public function getName() |
||
88 | |||
89 | public function getTitle() |
||
93 | |||
94 | public function getModel() |
||
98 | |||
99 | public function getRepository() |
||
103 | |||
104 | public function getAccesses() |
||
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | public function getConfigs() |
||
124 | |||
125 | /** |
||
126 | * {@inheritdoc} |
||
127 | */ |
||
128 | public function fireView() |
||
147 | |||
148 | public function get() |
||
156 | |||
157 | /** |
||
158 | * {@inheritdoc} |
||
159 | */ |
||
160 | public function fireCreate() |
||
180 | |||
181 | /** |
||
182 | * {@inheritdoc} |
||
183 | */ |
||
184 | public function store() |
||
190 | |||
191 | /** |
||
192 | * {@inheritdoc} |
||
193 | */ |
||
194 | public function fireEdit($id) |
||
217 | |||
218 | /** |
||
219 | * {@inheritdoc} |
||
220 | */ |
||
221 | public function update($id) |
||
226 | |||
227 | public function delete($id) |
||
232 | |||
233 | public function forceDelete($id) |
||
238 | |||
239 | public function restore($id) |
||
244 | |||
245 | protected function bootIfNotBooted() |
||
257 | |||
258 | /** |
||
259 | * The "booting" method of the model. |
||
260 | * |
||
261 | * @return void |
||
262 | */ |
||
263 | protected static function boot() |
||
267 | |||
268 | /** |
||
269 | * Boot all of the bootable traits on the model. |
||
270 | * |
||
271 | * @return void |
||
272 | */ |
||
273 | protected static function bootTraits() |
||
283 | } |
||
284 |
Let’s assume you have a class which uses late-static binding:
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: