small fixing, added throw errors in widgets
This commit is contained in:
@@ -19,7 +19,7 @@ class ClientWidgetContactController extends Controller
|
|||||||
return new ClientContactWidgetResource(
|
return new ClientContactWidgetResource(
|
||||||
ContactWidget::query()
|
ContactWidget::query()
|
||||||
->where('slug', $slug)
|
->where('slug', $slug)
|
||||||
->first()
|
->firstOrFail()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class ClientWidgetFormController extends Controller
|
|||||||
{
|
{
|
||||||
public function single(string $id)
|
public function single(string $id)
|
||||||
{
|
{
|
||||||
return new ClientFormResource(CustomForm::query()->where('status', CustomFormStatus::PUBLISHED)->where('form_id', $id)->first());
|
return new ClientFormResource(CustomForm::query()->where('status', CustomFormStatus::PUBLISHED)->where('form_id', $id)->firstOrFail());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit(int $id, Request $request)
|
public function submit(int $id, Request $request)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Cache;
|
|||||||
|
|
||||||
class ClientWidgetPageController extends Controller
|
class ClientWidgetPageController extends Controller
|
||||||
{
|
{
|
||||||
public function single(int $id)
|
public function single(int $id): \Illuminate\Http\JsonResponse
|
||||||
{
|
{
|
||||||
$cacheKey = 'page_' . md5($id);
|
$cacheKey = 'page_' . md5($id);
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ class ClientWidgetPageController extends Controller
|
|||||||
$page = Cache::remember($cacheKey, now()->addHours(1), function () use ($id) {
|
$page = Cache::remember($cacheKey, now()->addHours(1), function () use ($id) {
|
||||||
return Page::where('id', '=', $id)
|
return Page::where('id', '=', $id)
|
||||||
->with('section.pages.section', 'section.mainSection')
|
->with('section.pages.section', 'section.mainSection')
|
||||||
->first();
|
->firstOrFail();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isset($page->section)) {
|
if (isset($page->section)) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ClientWidgetPageReferenceListController extends Controller
|
|||||||
return new ClientPageReferenceListResource(
|
return new ClientPageReferenceListResource(
|
||||||
PageReferenceList::query()
|
PageReferenceList::query()
|
||||||
->where('slug', $slug)
|
->where('slug', $slug)
|
||||||
->first()
|
->firstOrFail()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class ClientWidgetPostController extends Controller
|
|||||||
|
|
||||||
return Cache::remember($cacheKey, now()->addMinutes(10), function () use ($id) {
|
return Cache::remember($cacheKey, now()->addMinutes(10), function () use ($id) {
|
||||||
return new PostThumbnailResource(
|
return new PostThumbnailResource(
|
||||||
Post::query()->with('category')->find($id)
|
Post::query()->with('category')->find($id)->firstOrFail()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class ClientWidgetSliderController extends Controller
|
|||||||
->with(['slides' => function($query) {
|
->with(['slides' => function($query) {
|
||||||
$query->where('is_active', true);
|
$query->where('is_active', true);
|
||||||
}])
|
}])
|
||||||
->first();
|
->firstOrFail();
|
||||||
|
|
||||||
return $slider ?: null;
|
return $slider ?: null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="loading" class="flex flex-col space-y-4">
|
<div v-if="loading" class="flex flex-col space-y-4">
|
||||||
<div class="group block rounded-xl overflow-hidden animate-pulse">
|
<div class="group block p-4 overflow-hidden animate-pulse">
|
||||||
<div class="flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-5">
|
<div class="w-full">
|
||||||
<div class="shrink-0 relative rounded-xl overflow-hidden w-full sm:w-56 h-44">
|
<div class="shrink-0 relative rounded-xl overflow-hidden w-full h-44">
|
||||||
<div class="w-full h-full bg-gray-200"></div>
|
<div class="w-full h-full bg-gray-200"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="!loading & contacts">
|
<div v-else-if="!loading && contacts">
|
||||||
<section class="bg-[#F5F5F5] w-full py-10">
|
<section class="bg-[#F5F5F5] w-full py-10">
|
||||||
<div class="max-w-screen-xl md:flex justify-around w-full mx-auto px-4 md:py-[50px] flex-wrap space-y-7 md:space-y-0">
|
<div class="max-w-screen-xl md:flex justify-around w-full mx-auto px-4 md:py-[50px] flex-wrap space-y-7 md:space-y-0">
|
||||||
<ContactGroup v-for="contact in contacts.data.content"
|
<ContactGroup v-for="contact in contacts.data.content"
|
||||||
@@ -43,6 +43,7 @@ export default {
|
|||||||
this.loading = false; // Установить состояние загрузки в false
|
this.loading = false; // Установить состояние загрузки в false
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
this.loading = false; // Установить состояние загрузки в false
|
||||||
console.error('Ошибка:', error);
|
console.error('Ошибка:', error);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="!loading & resource">
|
<div v-else-if="!loading && resource">
|
||||||
|
|
||||||
<!-- Card Blog -->
|
<!-- Card Blog -->
|
||||||
<div class="px-0 py-10 sm:px-2 lg:py-14 mx-auto">
|
<div class="px-0 py-10 sm:px-2 lg:py-14 mx-auto">
|
||||||
|
|||||||
Reference in New Issue
Block a user