Conditions | 6 |
Paths | 6 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function __get($property) |
||
40 | { |
||
41 | if ($this->has($property)) { |
||
42 | return $this->get($property); |
||
43 | } |
||
44 | |||
45 | if (!$this->get('__model')) { |
||
46 | return; |
||
47 | } |
||
48 | |||
49 | $model = $this->get('__model'); |
||
50 | |||
51 | if(!class_exists($model)){ |
||
52 | $model = Relation::getMorphedModel($model); |
||
53 | } |
||
54 | |||
55 | $class = explode('\\', $model); |
||
56 | |||
57 | if (strtolower(end($class)) === $property || 'model' === $property) { |
||
58 | $model = new $model(); |
||
59 | |||
60 | return $model->find($this->id); |
||
61 | } |
||
62 | } |
||
63 | |||
82 |