| Total Complexity | 7 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Preference extends Model |
||
| 12 | { |
||
| 13 | use LogsActivity; |
||
| 14 | |||
| 15 | protected $guarded = []; |
||
| 16 | |||
| 17 | // Forget cache on updating or saving and deleting |
||
| 18 | public static function boot() |
||
| 19 | { |
||
| 20 | parent::boot(); |
||
| 21 | |||
| 22 | static::saving(function () { |
||
| 23 | self::cacheKey(); |
||
| 24 | }); |
||
| 25 | |||
| 26 | static::deleting(function () { |
||
| 27 | self::cacheKey(); |
||
| 28 | }); |
||
| 29 | } |
||
| 30 | |||
| 31 | // Cache Keys |
||
| 32 | private static function cacheKey() |
||
| 33 | { |
||
| 34 | Cache::has('preferences') ? Cache::forget('preferences') : ''; |
||
| 35 | } |
||
| 36 | |||
| 37 | // Logs |
||
| 38 | protected static $logName = 'preference'; |
||
| 39 | |||
| 40 | public function getActivitylogOptions(): LogOptions |
||
| 43 | } |
||
| 44 | |||
| 45 | // Casts |
||
| 46 | public $casts = [ |
||
| 47 | 'roles' => 'array', |
||
| 48 | ]; |
||
| 49 | |||
| 50 | // Mutators |
||
| 51 | public function setPreferenceAttribute($value) |
||
| 54 | } |
||
| 55 | |||
| 56 | // Accessors |
||
| 57 | public function getPreferenceAttribute($value) |
||
| 58 | { |
||
| 59 | return ucwords(str_replace('_', ' ', $value)); |
||
| 60 | } |
||
| 61 | |||
| 62 | // Relation |
||
| 63 | |||
| 64 | /** |
||
| 65 | * The users that belong to the Preference. |
||
| 66 | * |
||
| 67 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
| 68 | */ |
||
| 69 | public function users() |
||
| 72 | } |
||
| 73 | } |
||
| 74 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths