-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
7 changed files
with
68 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Javaabu\Helpers\Media; | ||
|
||
use Spatie\MediaLibrary\MediaCollections\Models\Media; | ||
use Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator; | ||
|
||
class UuidPathGenerator extends DefaultPathGenerator | ||
{ | ||
/* | ||
* Get a unique base path for the given media. | ||
*/ | ||
protected function getBasePath(Media $media): string | ||
{ | ||
$prefix = config('media-library.prefix', ''); | ||
|
||
if ($prefix !== '') { | ||
return $prefix.'/'.$media->uuid; | ||
} | ||
|
||
return $media->uuid; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Javaabu\Helpers\Tests\Unit; | ||
|
||
use Javaabu\Helpers\Enums\UserStatuses; | ||
use Javaabu\Helpers\Tests\TestCase; | ||
|
||
class EnumsTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_can_generate_enum_label() | ||
{ | ||
$this->assertEquals('Pending', UserStatuses::PENDING->getLabel()); | ||
$this->assertEquals([ | ||
'approved' => 'Approved', | ||
'pending' => 'Pending', | ||
'banned' => 'Banned' | ||
], UserStatuses::getLabels()); | ||
} | ||
} |