Add fallback notice
This commit is contained in:
parent
63fb409951
commit
bcf708ecc3
|
@ -32,6 +32,8 @@ class MediaData extends Data
|
|||
|
||||
public array $conversions = [];
|
||||
|
||||
public bool $fallback = false;
|
||||
|
||||
public static function fromMedia(Media $media): self
|
||||
{
|
||||
$conversions = collect($media->getMediaConversionNames())->flip()->map(fn ($integer, $conversion) => [
|
||||
|
@ -60,6 +62,7 @@ class MediaData extends Data
|
|||
'name' => pathinfo($default[0], PATHINFO_FILENAME),
|
||||
'file_name' => pathinfo($default[0], PATHINFO_BASENAME),
|
||||
'properties' => [],
|
||||
'fallback' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ test('it gets media for single', function () {
|
|||
$response->assertStatus(200);
|
||||
$response->assertJsonPath('id', $media->id);
|
||||
$response->assertJsonPath('properties.test', 'old');
|
||||
$response->assertJsonPath('fallback', false);
|
||||
});
|
||||
|
||||
test('it checks for authorization', function () {
|
||||
|
@ -71,4 +72,5 @@ test('test it gets default single media', function () {
|
|||
$response->assertJsonPath('original_url', Storage::disk('public')->url('default.jpg'));
|
||||
$response->assertJsonPath('name', 'default');
|
||||
$response->assertJsonPath('file_name', 'default.jpg');
|
||||
$response->assertJsonPath('fallback', true);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue