Conditions | 3 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace Cviebrock\EloquentLogLazyLoading; |
||
16 | protected function getRelationshipFromMethod($method) |
||
17 | { |
||
18 | $modelName = static::class; |
||
19 | |||
20 | $exception = new LazyLoadingException( |
||
21 | "Attempting to lazy-load relation '$method' on model '$modelName'" |
||
22 | ); |
||
23 | |||
24 | if (property_exists($this, 'disableLazyLoading') && $this->disableLazyLoading) { |
||
|
|||
25 | throw $exception; |
||
26 | } |
||
27 | |||
28 | report($exception); |
||
29 | |||
30 | return parent::getRelationshipFromMethod($method); |
||
31 | } |
||
32 | } |
||
33 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: