pratiksh404 /
adminetic
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Pratiksh\Adminetic\Models\Admin; |
||
| 4 | |||
| 5 | use App\Models\User; |
||
|
0 ignored issues
–
show
|
|||
| 6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
||
| 7 | use Illuminate\Database\Eloquent\Model; |
||
| 8 | use Illuminate\Support\Facades\Cache; |
||
| 9 | use Spatie\Activitylog\LogOptions; |
||
| 10 | use Spatie\Activitylog\Traits\LogsActivity; |
||
| 11 | |||
| 12 | class Role extends Model |
||
| 13 | { |
||
| 14 | use HasFactory; |
||
| 15 | use LogsActivity; |
||
|
0 ignored issues
–
show
The trait
Spatie\Activitylog\Traits\LogsActivity requires some properties which are not provided by Pratiksh\Adminetic\Models\Admin\Role: $submitEmptyLogs, $name, $logExceptAttributes, $attributeRawValues, $dontLogIfAttributesChangedOnly, $descriptionForEvent, $logOnlyDirty, $logFillable, $value, $logUnguarded, $logAttributes
Loading history...
|
|||
| 16 | |||
| 17 | protected $guarded = []; |
||
| 18 | |||
| 19 | // Mutators |
||
| 20 | public function setNameAttribute($value) |
||
| 21 | { |
||
| 22 | $this->attributes['name'] = strtolower(str_replace(' ', '_', $value)); |
||
| 23 | } |
||
| 24 | |||
| 25 | // Relations |
||
| 26 | public function users() |
||
| 27 | { |
||
| 28 | return $this->belongsToMany(User::class)->withTimestamps(); |
||
| 29 | } |
||
| 30 | |||
| 31 | // Forget cache on updating or saving and deleting |
||
| 32 | public static function boot() |
||
| 33 | { |
||
| 34 | parent::boot(); |
||
| 35 | |||
| 36 | static::saving(function () { |
||
| 37 | self::cacheKey(); |
||
| 38 | }); |
||
| 39 | |||
| 40 | static::deleting(function () { |
||
| 41 | self::cacheKey(); |
||
| 42 | }); |
||
| 43 | } |
||
| 44 | |||
| 45 | // Cache Keys |
||
| 46 | private static function cacheKey() |
||
| 47 | { |
||
| 48 | Cache::has('roles') ? Cache::forget('roles') : ''; |
||
| 49 | } |
||
| 50 | |||
| 51 | // Logs |
||
| 52 | protected static $logName = 'role'; |
||
| 53 | |||
| 54 | public function getActivitylogOptions(): LogOptions |
||
| 55 | { |
||
| 56 | return LogOptions::defaults(); |
||
| 57 | } |
||
| 58 | |||
| 59 | // Relations |
||
| 60 | public function permissions() |
||
| 61 | { |
||
| 62 | return $this->hasMany(Permission::class); |
||
| 63 | } |
||
| 64 | } |
||
| 65 |
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