public static function doesNotBelongToModel(Media $media, Model $model) { $modelClass = get_class($model); return new static("Media with id {$media->getKey()} cannot be deleted because it does not belong to model {$modelClass} with id {$model->id}"); }
public static function doesNotBelongToCollection(string $collectionName, Media $media) { return new static("Media id {$media->getKey()} is not part of collection `{$collectionName}`"); }
/** * Get a (unique) base path for the given media. * * @param \Spatie\MediaLibrary\Media $media * * @return string */ protected function getBasePath(Media $media) { return $media->getKey(); }