Conditions | 4 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php namespace App\Modules\V1\Core\Traits; |
||
12 | public function newFromBuilder($attributes = [], $connection = null) |
||
13 | { |
||
14 | $model = parent::newFromBuilder($attributes, $connection); |
||
15 | |||
16 | foreach ($model->attributes AS $key => $value) |
||
17 | { |
||
18 | if (isset($this->translatable) && in_array($key, $this->translatable)) |
||
|
|||
19 | { |
||
20 | $model->$key = $this->getTranslatedAttribute($key, $value); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | return $model; |
||
25 | } |
||
26 | |||
52 | } |
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: