pratiksh404 /
adminetic-website
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Adminetic\Website\Models\Admin; |
||||
| 4 | |||||
| 5 | use Illuminate\Database\Eloquent\Model; |
||||
| 6 | use Illuminate\Support\Facades\Cache; |
||||
| 7 | use Spatie\Activitylog\LogOptions; |
||||
|
0 ignored issues
–
show
|
|||||
| 8 | use Spatie\Activitylog\Traits\LogsActivity; |
||||
|
0 ignored issues
–
show
The type
Spatie\Activitylog\Traits\LogsActivity was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 9 | use Spatie\MediaLibrary\HasMedia; |
||||
|
0 ignored issues
–
show
The type
Spatie\MediaLibrary\HasMedia was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 10 | use Spatie\MediaLibrary\InteractsWithMedia; |
||||
|
0 ignored issues
–
show
The type
Spatie\MediaLibrary\InteractsWithMedia was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 11 | use Spatie\SchemaOrg\Schema; |
||||
| 12 | use Spatie\SchemaOrg\SoftwareApplication; |
||||
| 13 | |||||
| 14 | class Software extends Model implements HasMedia |
||||
| 15 | { |
||||
| 16 | use LogsActivity, InteractsWithMedia; |
||||
| 17 | |||||
| 18 | protected $guarded = []; |
||||
| 19 | |||||
| 20 | // Forget cache on updating or saving and deleting |
||||
| 21 | public static function boot() |
||||
| 22 | { |
||||
| 23 | parent::boot(); |
||||
| 24 | |||||
| 25 | static::saving(function () { |
||||
| 26 | self::cacheKey(); |
||||
| 27 | }); |
||||
| 28 | |||||
| 29 | static::deleting(function () { |
||||
| 30 | self::cacheKey(); |
||||
| 31 | }); |
||||
| 32 | } |
||||
| 33 | |||||
| 34 | // Cache Keys |
||||
| 35 | private static function cacheKey() |
||||
| 36 | { |
||||
| 37 | Cache::has('software') ? Cache::forget('software') : ''; |
||||
| 38 | } |
||||
| 39 | |||||
| 40 | // Logs |
||||
| 41 | protected static $logName = 'software'; |
||||
| 42 | |||||
| 43 | public function getActivitylogOptions(): LogOptions |
||||
| 44 | { |
||||
| 45 | return LogOptions::defaults(); |
||||
| 46 | } |
||||
| 47 | |||||
| 48 | protected $appends = ['banner']; |
||||
| 49 | |||||
| 50 | protected $casts = [ |
||||
| 51 | 'data' => 'array', |
||||
| 52 | ]; |
||||
| 53 | |||||
| 54 | public function __construct(array $attributes = []) |
||||
| 55 | { |
||||
| 56 | $this->table = config('website.table_prefix', 'website').'_softwares'; |
||||
| 57 | |||||
| 58 | parent::__construct($attributes); |
||||
| 59 | } |
||||
| 60 | |||||
| 61 | // Accessors |
||||
| 62 | public function getBannerAttribute() |
||||
| 63 | { |
||||
| 64 | return ! is_null($this->getFirstMedia('banner')) ? $this->getFirstMediaUrl('banner') : logoBanner(); |
||||
|
0 ignored issues
–
show
The function
logoBanner was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 65 | } |
||||
| 66 | |||||
| 67 | // Relationships |
||||
| 68 | public function category() |
||||
| 69 | { |
||||
| 70 | return $this->belongsTo(Category::class); |
||||
| 71 | } |
||||
| 72 | |||||
| 73 | public function inquiries() |
||||
| 74 | { |
||||
| 75 | return $this->hasMany(Inquiry::class); |
||||
| 76 | } |
||||
| 77 | |||||
| 78 | // Scopes |
||||
| 79 | public function scopePosition($qry) |
||||
| 80 | { |
||||
| 81 | return $qry->orderBy('position'); |
||||
| 82 | } |
||||
| 83 | |||||
| 84 | public function scopeActive($qry) |
||||
| 85 | { |
||||
| 86 | return $qry->where('active', 1); |
||||
| 87 | } |
||||
| 88 | |||||
| 89 | public function scopeFeatured($qry) |
||||
| 90 | { |
||||
| 91 | return $qry->where('featured', 1); |
||||
| 92 | } |
||||
| 93 | |||||
| 94 | public function searchSchema() |
||||
| 95 | { |
||||
| 96 | $modules = isset($this->data['modules']) ? $this->data['modules'] : null; |
||||
|
0 ignored issues
–
show
|
|||||
| 97 | $schema = Schema::softwareApplication() |
||||
| 98 | ->name($this->meta_name ?? $this->name) |
||||
|
0 ignored issues
–
show
|
|||||
| 99 | ->author(title()) |
||||
|
0 ignored issues
–
show
The function
title was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 100 | ->description($this->meta_description ?? $this->excerpt) |
||||
|
0 ignored issues
–
show
|
|||||
| 101 | ->image($this->banner) |
||||
|
0 ignored issues
–
show
|
|||||
| 102 | ->if(! is_null($modules), function (SoftwareApplication $schema) use ($modules) { |
||||
| 103 | $schema->email(collect($modules)->pluck('name')->toArray()); |
||||
| 104 | }) |
||||
| 105 | ->url(route('website.software', ['software' => $this->slug])) |
||||
|
0 ignored issues
–
show
|
|||||
| 106 | ->keywords($this->meta_keywords); |
||||
|
0 ignored issues
–
show
|
|||||
| 107 | |||||
| 108 | return $schema->toScript(); |
||||
| 109 | } |
||||
| 110 | } |
||||
| 111 |
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