major
parent
23bf227650
commit
e5908aca5a
|
|
@ -11,6 +11,7 @@ use App\Transformers\Registries\RegistryTransformer;
|
|||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
|
||||
class PublicationsController extends Controller {
|
||||
protected Publication $model;
|
||||
|
|
@ -27,7 +28,10 @@ class PublicationsController extends Controller {
|
|||
public function index(Request $request): JsonResponse {
|
||||
$query = $this->model->query()->orderBy('published_at', 'desc');
|
||||
$user = Auth::user();
|
||||
if (!($user->isAdmin ?? null)) $query->where(['is_published' => true]);
|
||||
if (!($user->isAdmin ?? null)) {
|
||||
$query->where(['is_published' => true]);
|
||||
$query->where('published_at', '<=', now());
|
||||
}
|
||||
|
||||
if ($page = Page::byUuid($request->get('page_id'))->first()) {
|
||||
$query->where(['page_id' => $page->id]);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,11 @@ class DictionariesTableSeeder extends Seeder {
|
|||
'listings' => [
|
||||
'title' => 'Перечни ПП',
|
||||
'items' => ['pp1521' => 'ПП №1521 от 26.12.2014 г.', 'pp985' => 'ПП № 985 от 04.07.2020 г.', 'pp815' => 'ПП № 815 от 28.05.2021 г.']
|
||||
]
|
||||
],
|
||||
'images-types' => [
|
||||
'title' => 'Тип изображения',
|
||||
'items' => ['full-width' => 'во всю ширину', 'tiles' => 'плиткой']
|
||||
],
|
||||
];
|
||||
|
||||
public function run() {
|
||||
|
|
|
|||
|
|
@ -53,22 +53,6 @@ class FieldsTableSeeder extends Seeder {
|
|||
'required' => true
|
||||
],
|
||||
|
||||
// 'list-type' => [
|
||||
// 'title' => 'Вид списка',
|
||||
// 'type' => FieldType::RELATION,
|
||||
// 'required' => true,
|
||||
// 'params' => [
|
||||
// 'related' => DictionaryItem::class, 'transformer' => DictionaryItemTransformer::class,
|
||||
// 'options' => ['show' => true, 'whereHas' => ['dictionary' => ['name' => 'list-types']]]
|
||||
// ]
|
||||
// ],
|
||||
// 'list-items' => [
|
||||
// 'title' => 'Элементы списка',
|
||||
// 'type' => FieldType::TEXT,
|
||||
// 'multiple' => true,
|
||||
// 'required' => true
|
||||
// ],
|
||||
|
||||
'images' => [
|
||||
'title' => 'Изображения',
|
||||
'type' => FieldType::IMAGE,
|
||||
|
|
@ -80,6 +64,15 @@ class FieldsTableSeeder extends Seeder {
|
|||
'multiple' => true,
|
||||
'required' => true
|
||||
],
|
||||
'images-type' => [
|
||||
'title' => 'Тип изображения',
|
||||
'type' => FieldType::RELATION,
|
||||
'required' => true,
|
||||
'params' => [
|
||||
'related' => DictionaryItem::class, 'transformer' => DictionaryItemTransformer::class,
|
||||
'options' => ['show' => true, 'whereHas' => ['dictionary' => ['name' => 'images-types']]]
|
||||
]
|
||||
],
|
||||
|
||||
'video-url' => [
|
||||
'title' => 'Ссылка на видео',
|
||||
|
|
@ -98,12 +91,6 @@ class FieldsTableSeeder extends Seeder {
|
|||
'required' => true
|
||||
],
|
||||
|
||||
'iframe-url' => [
|
||||
'title' => 'Ссылка',
|
||||
'type' => FieldType::STRING,
|
||||
'required' => true
|
||||
],
|
||||
|
||||
'contact-name' => [
|
||||
'title' => 'Наименование',
|
||||
'type' => FieldType::STRING,
|
||||
|
|
|
|||
|
|
@ -25,14 +25,10 @@ class ObjectTypeFieldsTableSeeder extends Seeder {
|
|||
'fields' => ['html-required']
|
||||
]
|
||||
],
|
||||
// 'page-section-list' => [
|
||||
// 'common' => [
|
||||
// 'fields' => ['list-type', 'list-items']
|
||||
// ]
|
||||
// ],
|
||||
|
||||
'page-section-images' => [
|
||||
'common' => [
|
||||
'fields' => ['images-required']
|
||||
'fields' => ['images-required', 'images-type']
|
||||
]
|
||||
],
|
||||
'page-section-documents' => [
|
||||
|
|
@ -50,11 +46,6 @@ class ObjectTypeFieldsTableSeeder extends Seeder {
|
|||
'fields' => ['button-title', 'button-url']
|
||||
]
|
||||
],
|
||||
'page-section-iframe' => [
|
||||
'common' => [
|
||||
'fields' => ['iframe-url']
|
||||
]
|
||||
],
|
||||
'page-section-contacts' => [
|
||||
'common' => [
|
||||
'fields' => ['contact-name', 'contact-legal-address', 'contact-location-address', 'contact-email', 'contact-phone', 'contact-description']
|
||||
|
|
|
|||
|
|
@ -20,33 +20,38 @@ class ObjectTypesTableSeeder extends Seeder {
|
|||
'page-section-html' => [
|
||||
'title' => 'Текстовый блок'
|
||||
],
|
||||
// 'page-section-list' => [
|
||||
// 'title' => 'Список'
|
||||
// ],
|
||||
'page-section-images' => [
|
||||
'title' => 'Изображения'
|
||||
],
|
||||
'page-section-documents' => [
|
||||
'title' => 'Документы'
|
||||
],
|
||||
'page-section-video' => [
|
||||
'title' => 'Видео'
|
||||
'page-section-media' => [
|
||||
'title' => 'Визуальные элементы',
|
||||
'children' => [
|
||||
|
||||
'page-section-images' => [
|
||||
'title' => 'Изображения'
|
||||
],
|
||||
'page-section-video' => [
|
||||
'title' => 'Видео'
|
||||
],
|
||||
'page-section-maps' => [
|
||||
'title' => 'Карта'
|
||||
],
|
||||
]
|
||||
],
|
||||
'page-section-button' => [
|
||||
'title' => 'Кнопка'
|
||||
'page-section-interactive' => [
|
||||
'title' => 'Интерактивные элементы',
|
||||
'children' => [
|
||||
'page-section-button' => [
|
||||
'title' => 'Кнопка'
|
||||
],
|
||||
'page-section-contacts' => [
|
||||
'title' => 'Контактная информация'
|
||||
],
|
||||
'page-section-feedback' => [
|
||||
'title' => 'Форма обратной связи'
|
||||
],
|
||||
]
|
||||
],
|
||||
'page-section-iframe' => [
|
||||
'title' => 'Интерактивное окно'
|
||||
],
|
||||
'page-section-contacts' => [
|
||||
'title' => 'Контактная информация'
|
||||
],
|
||||
'page-section-feedback' => [
|
||||
'title' => 'Форма обратной связи'
|
||||
],
|
||||
'page-section-maps' => [
|
||||
'title' => 'Карта'
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue