| Total Complexity | 9 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 7 | class Module extends Eloquent |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The attributes that are mass assignable. |
||
| 11 | * |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | protected $fillable = [ |
||
| 15 | 'name', 'slug', 'hintpath', 'path', 'type', 'version', 'author', 'json', |
||
| 16 | ]; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The attributes that are castable. |
||
| 20 | * |
||
| 21 | * @var array |
||
| 22 | */ |
||
| 23 | protected $casts = [ |
||
| 24 | 'json' => 'array', |
||
| 25 | ]; |
||
| 26 | |||
| 27 | public function getSettingsAttribute() |
||
| 28 | { |
||
| 29 | if (array_key_exists('settings', $this->json)) { |
||
|
|
|||
| 30 | return $this->json['settings']; |
||
| 31 | } |
||
| 32 | |||
| 33 | if (!array_key_exists('admin', $this->json)) { |
||
| 34 | return []; |
||
| 35 | } |
||
| 36 | |||
| 37 | if (!array_key_exists('settings', $this->json['admin'])) { |
||
| 38 | return []; |
||
| 39 | } |
||
| 40 | |||
| 41 | return $this->json['admin']['settings']; |
||
| 42 | } |
||
| 43 | |||
| 44 | public function getSetting(string $string) |
||
| 49 | } |
||
| 50 | |||
| 51 | private function resolveSetting($var) |
||
| 64 | } |
||
| 65 | } |
||
| 66 |