few updates

master
Константин 2023-11-10 12:56:32 +03:00
parent 58f213ae23
commit 31d28c605b
5 changed files with 68 additions and 35 deletions

View File

@ -146,7 +146,7 @@ class UploadFileController extends Controller {
protected function storeInFileSystem(array $attributes): string { protected function storeInFileSystem(array $attributes): string {
$filename = md5(Str::random(16).date('U')); $filename = md5(Str::random(16).date('U'));
$path = "upload/{$filename[0]}/$filename.{$this->validMimes[$attributes['mime']]['extension']}"; $path = "public/upload/{$filename[0]}/$filename.{$this->validMimes[$attributes['mime']]['extension']}";
Storage::put($path, $attributes['content']); Storage::put($path, $attributes['content']);
return $path; return $path;
} }

View File

@ -29,7 +29,8 @@ class Asset extends Model {
{ {
$result = [ $result = [
'open' => asset("/api/assets/{$this->uuid}"), 'open' => asset("/api/assets/{$this->uuid}"),
'download' => asset("/api/assets/{$this->uuid}/download") 'download' => asset("/api/assets/{$this->uuid}/download"),
'direct' => asset("storage/{$this->path}")
]; ];
if ($this->type == 'image') { if ($this->type == 'image') {
$result['full'] = asset("/api/assets/{$this->uuid}/render"); $result['full'] = asset("/api/assets/{$this->uuid}/render");

View File

@ -172,8 +172,4 @@ class Page extends Model {
return self::query()->where(['parent_id' => 0])->orderBy('ord')->get(); return self::query()->where(['parent_id' => 0])->orderBy('ord')->get();
} }
public static function main() {
return self::query()->firstOrCreate(['parent_id' => -1]);
}
} }

View File

@ -4,6 +4,7 @@ namespace Database\Seeders\Pages;
use App\Models\Pages\Page; use App\Models\Pages\Page;
use App\Models\Pages\PageType; use App\Models\Pages\PageType;
use App\Models\Publications\PublicationType;
use App\Models\Registries\RegistryType; use App\Models\Registries\RegistryType;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -13,49 +14,82 @@ class PagesTableSeeder extends Seeder {
'Главная' => [ 'Главная' => [
'slug' => '', 'slug' => '',
'children' => [ 'children' => [
'Страница 1' => [ 'Контентная страница' => [
'children' => [ 'children' => [
одстраница 1' => [], ример 1' => [],
одстраница 2' => [], ример 2' => [],
одстраница 3' => [], ример 3' => [],
] ]
], ],
'Страница 2' => [], 'Реестры' => [
'Страница 3' => [], 'type' => PageType::NAV_PAGE,
'Страница 4' => [], 'children' => [
'Страница 5' => [] RegistryType::TITLES[RegistryType::SIMPLE] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
RegistryType::TITLES[RegistryType::CATEGORIZED] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CATEGORIZED],
RegistryType::TITLES[RegistryType::COMPANIES] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::COMPANIES],
RegistryType::TITLES[RegistryType::RULESET] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RULESET],
RegistryType::TITLES[RegistryType::DEVELOPMENTS] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::DEVELOPMENTS],
RegistryType::TITLES[RegistryType::TECHNICAL_CERTIFICATES] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::TECHNICAL_CERTIFICATES],
RegistryType::TITLES[RegistryType::NTD] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::NTD],
RegistryType::TITLES[RegistryType::RESEARCHES] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RESEARCHES],
RegistryType::TITLES[RegistryType::DISCUSSIONS] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::DISCUSSIONS],
RegistryType::TITLES[RegistryType::CERTIFICATES] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFICATES],
RegistryType::TITLES[RegistryType::EXPERTS] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::EXPERTS],
RegistryType::TITLES[RegistryType::LABORATORIES] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::LABORATORIES],
RegistryType::TITLES[RegistryType::CERTIFIERS] => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFIERS],
]
],
'Публикации' => [
'type' => PageType::NAV_PAGE,
'children' => [
PublicationType::TITLES[PublicationType::NEWS] => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::NEWS],
PublicationType::TITLES[PublicationType::PHOTOS] => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::PHOTOS],
PublicationType::TITLES[PublicationType::PORTFOLIO] => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::PORTFOLIO],
PublicationType::TITLES[PublicationType::SMI] => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::SMI],
PublicationType::TITLES[PublicationType::VIDEO] => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::VIDEO]
]
],
'Структура ТК' => ['type' => PageType::TK_STRUCTURE]
] ]
], ],
'Main page' => [ 'Main page' => [
'slug' => 'en', 'slug' => 'en',
'children' => [ 'children' => [
'page 1' => [ 'Content page' => [
'children' => [ 'children' => [
'subpage 1' => [], 'Example 1' => [],
'subpage 2' => [], 'Example 2' => [],
'subpage 3' => [] 'Example 3' => []
] ]
], ],
'page 2' => [], 'Registries' => [
'page 3' => [], 'type' => PageType::NAV_PAGE,
'page 4' => [], 'children' => [
'page 5' => [] 'Simple registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::SIMPLE],
'Categorized registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CATEGORIZED],
'Companies registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::COMPANIES],
'Ruleset registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RULESET],
'Developments registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::DEVELOPMENTS],
'Technical certificates registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::TECHNICAL_CERTIFICATES],
'STD registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::NTD],
'Researches registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::RESEARCHES],
'Public discussions registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::DISCUSSIONS],
'Certificates registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFICATES],
'Experts registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::EXPERTS],
'Laboratories registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::LABORATORIES],
'Certification agencies registry' => ['type' => PageType::REGISTRY, 'registry_type' => RegistryType::CERTIFIERS],
] ]
], ],
'Головна сторінка' => [ 'Publications' => [
'slug' => 'ua', 'type' => PageType::NAV_PAGE,
'children' => [ 'children' => [
'Сторінка 1' => [ 'News' => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::NEWS],
'children' => [ 'Photo gallery' => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::PHOTOS],
'Підсторінка 1' => [], 'Portfolio' => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::PORTFOLIO],
'Підсторінка 2' => [], 'Mass media' => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::SMI],
'Підсторінка 3' => [] 'Video' => ['type' => PageType::PUBLICATIONS, 'sub_type' => PublicationType::VIDEO]
]
] ]
],
'Сторінка 2' => [],
'Сторінка 3' => [],
'Сторінка 4' => [],
'Сторінка 5' => []
] ]
] ]
]; ];

2
public/storage/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore