Update SlideFactory to set image URL to null, modify SlideResource to make image field optional, and adjust Slider components to display a default image when no URL is provided
This commit is contained in:
@@ -23,7 +23,7 @@ class SlideFactory extends Factory
|
|||||||
'title' => $this->faker->sentence(3),
|
'title' => $this->faker->sentence(3),
|
||||||
'content' => $this->faker->paragraph(2),
|
'content' => $this->faker->paragraph(2),
|
||||||
'image' => json_encode([
|
'image' => json_encode([
|
||||||
'url' => '/public/img/thumbnail-1.png',
|
'url' => null,
|
||||||
'shading' => $this->faker->randomFloat(1, 0, 1)
|
'shading' => $this->faker->randomFloat(1, 0, 1)
|
||||||
]),
|
]),
|
||||||
'link' => '/news/' . $this->faker->slug,
|
'link' => '/news/' . $this->faker->slug,
|
||||||
|
|||||||
@@ -146,8 +146,7 @@ class SlideResource extends Resource
|
|||||||
->resize(50)
|
->resize(50)
|
||||||
->disk('public')
|
->disk('public')
|
||||||
->directory('images')
|
->directory('images')
|
||||||
->imageEditor()
|
->imageEditor(),
|
||||||
->required(),
|
|
||||||
ToggleButtons::make('image.shading')->inline()->grouped()->label('Уровень затемнения изображения')->options([
|
ToggleButtons::make('image.shading')->inline()->grouped()->label('Уровень затемнения изображения')->options([
|
||||||
'1' => 'Без затемнения',
|
'1' => 'Без затемнения',
|
||||||
'0.7' => 'Слабое затемнение',
|
'0.7' => 'Слабое затемнение',
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
data-nimg="fill"
|
data-nimg="fill"
|
||||||
class="object-cover rounded-xl transition-opacity duration-1000 absolute inset-0 h-full w-full"
|
class="object-cover rounded-xl transition-opacity duration-1000 absolute inset-0 h-full w-full"
|
||||||
sizes="100vw"
|
sizes="100vw"
|
||||||
:src="'/storage/' + slide.image.url"
|
:src="slide.image.url ? '/storage/' + slide.image.url : 'img/thumbnail-3.png'"
|
||||||
:class="{ 'opacity-1': currentIndex === index, 'opacity-0': currentIndex !== index }"
|
:class="{ 'opacity-1': currentIndex === index, 'opacity-0': currentIndex !== index }"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
data-nimg="fill"
|
data-nimg="fill"
|
||||||
class="object-cover transition-opacity duration-1000 absolute inset-0 h-full w-full"
|
class="object-cover transition-opacity duration-1000 absolute inset-0 h-full w-full"
|
||||||
sizes="100vw"
|
sizes="100vw"
|
||||||
:src="'/storage/' + slide.image.url"
|
:src="slide.image.url ? '/storage/' + slide.image.url : 'img/thumbnail-3.png'"
|
||||||
:loading="index === 0 ? 'eager' : 'lazy'"
|
:loading="index === 0 ? 'eager' : 'lazy'"
|
||||||
:class="{ 'opacity-1': currentIndex === index, 'opacity-0': currentIndex !== index }"
|
:class="{ 'opacity-1': currentIndex === index, 'opacity-0': currentIndex !== index }"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user