Skip to content

Commit

Permalink
Update PathGeneratorFactory.php
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored Mar 6, 2023
1 parent cc276d0 commit 6b27d43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Support/PathGenerator/PathGeneratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ protected static function getPathGeneratorClass(Media $media)
$defaultPathGeneratorClass = config('media-library.path_generator');

foreach (config('media-library.custom_path_generators', []) as $modelClass => $customPathGeneratorClass) {
if (static::assertMediaModelTypeEqualsTo($media, $modelClass)) {
if (static::mediaBelongToModelClass($media, $modelClass)) {
return $customPathGeneratorClass;
}
}

return $defaultPathGeneratorClass;
}

protected static function assertMediaModelTypeEqualsTo(Media $media, string $modelClass): bool
protected static function mediaBelongToModelClass(Media $media, string $modelClass): bool
{
// model doesn't have morphMap, so morph type and class are equal
if (is_a($media->model_type, $modelClass, true)) {
Expand Down

0 comments on commit 6b27d43

Please sign in to comment.