mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 23:31:06 +03:30
32 lines
678 B
PHP
32 lines
678 B
PHP
<?php
|
|
|
|
namespace App\Services\Media;
|
|
|
|
|
|
use Spatie\MediaLibrary\InteractsWithMedia;
|
|
|
|
trait HasMediaTrait
|
|
{
|
|
use InteractsWithMedia;
|
|
|
|
public function main_image()
|
|
{
|
|
return $this->morphOne(Media::class, 'model')->where('collection_name', 'main_image');
|
|
}
|
|
|
|
public function main_images()
|
|
{
|
|
return $this->morphMany(Media::class, 'model')->where('collection_name', 'main_images');
|
|
}
|
|
|
|
public static function isValidMediaCollection(string $collectionName): bool
|
|
{
|
|
return in_array($collectionName, static::getValidCollections());
|
|
}
|
|
|
|
protected static function getValidCollections(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|