From 8e0e562bd3b301bc17f4fef9a0bfd073d37d3901 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Sat, 17 Aug 2024 14:04:26 +0330 Subject: [PATCH 01/15] fixed no parent bugs group & category --- app/Http/Controllers/Admin/CategoryController.php | 4 +++- app/Http/Controllers/Admin/GroupController.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/CategoryController.php b/app/Http/Controllers/Admin/CategoryController.php index fad4f4a..6438253 100644 --- a/app/Http/Controllers/Admin/CategoryController.php +++ b/app/Http/Controllers/Admin/CategoryController.php @@ -57,7 +57,9 @@ class CategoryController extends XController $category->name = $request->input('name'); $category->subtitle = $request->input('subtitle'); $category->description = $request->input('description'); - $category->parent_id = $request->input('parent_id'); + if ($category->parent_id != ''){ + $category->parent_id = $request->input('parent_id',null); + } $category->slug = $this->getSlug($category); if ($request->has('image')) { $category->image = $this->storeFile('image', $category, 'categories'); diff --git a/app/Http/Controllers/Admin/GroupController.php b/app/Http/Controllers/Admin/GroupController.php index b1a9dc7..0d0f3d7 100644 --- a/app/Http/Controllers/Admin/GroupController.php +++ b/app/Http/Controllers/Admin/GroupController.php @@ -56,7 +56,9 @@ class GroupController extends XController $group->name = $request->input('name'); $group->subtitle = $request->input('subtitle'); $group->description = $request->input('description'); - $group->parent_id = $request->input('parent_id'); + if ($group->parent_id != ''){ + $group->parent_id = $request->input('parent_id',null); + } $group->slug = $this->getSlug($group); if ($request->has('image')){ $group->image = $this->storeFile('image',$group, 'groups'); From 78d8a90e7bdaa2a8891ce214a3bae42a8cf8100f Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 20 Aug 2024 05:52:28 +0330 Subject: [PATCH 02/15] added default header optimized area and part seeder --- app/Http/Controllers/Admin/AreaController.php | 7 + .../2024_07_04_050212_create_areas_table.php | 1 + database/seeders/AreaSeeder.php | 33 +++- database/seeders/PartSeeder.php | 157 ++++++++++++------ resources/js/client.js | 22 +-- resources/sass/client.scss | 22 +-- .../views/admin/areas/area-design.blade.php | 10 ++ resources/views/client/category.blade.php | 20 ++- resources/views/client/default-list.blade.php | 20 ++- resources/views/client/gallery.blade.php | 20 ++- resources/views/client/group.blade.php | 20 ++- resources/views/client/post.blade.php | 16 +- resources/views/client/welcome.blade.php | 20 ++- .../segments/menu/RecetMenu/RecetMenu.scss | 1 - .../GridPostList/GridPostList.blade.php | 2 + .../GridPostListSidebar.blade.php | 2 + .../SimplePostList/SimplePostList.blade.php | 2 + .../SimplePostListSideBar.blade.php | 36 ++-- .../ParallaxSlider/ParallaxSlider.blade.php | 4 +- .../slider/ParallaxSlider/ParallaxSlider.scss | 5 + 20 files changed, 300 insertions(+), 120 deletions(-) diff --git a/app/Http/Controllers/Admin/AreaController.php b/app/Http/Controllers/Admin/AreaController.php index ec3a3c5..6d7ba1e 100644 --- a/app/Http/Controllers/Admin/AreaController.php +++ b/app/Http/Controllers/Admin/AreaController.php @@ -20,6 +20,8 @@ class AreaController extends Controller public function desgin(Area $area) { + + $valids = []; foreach ($area->segment as $seg) { if (File::exists(resource_path() . '/views/segments/' . $seg)) { @@ -80,6 +82,11 @@ class AreaController extends Controller logAdmin(__METHOD__, __CLASS__, $area->id); + if ($request->has('use_default')){ + $area->use_default = 1; + $area->save(); + } + return redirect()->back()->with(['message' => __('area :NAME of website updated', ['NAME' => $area->name])]); } diff --git a/database/migrations/2024_07_04_050212_create_areas_table.php b/database/migrations/2024_07_04_050212_create_areas_table.php index 2677a58..161657d 100644 --- a/database/migrations/2024_07_04_050212_create_areas_table.php +++ b/database/migrations/2024_07_04_050212_create_areas_table.php @@ -18,6 +18,7 @@ return new class extends Migration $table->string('icon')->nullable(); $table->json('valid_segments'); $table->string('preview')->nullable(); + $table->boolean('use_default')->default(true); $table->timestamps(); }); } diff --git a/database/seeders/AreaSeeder.php b/database/seeders/AreaSeeder.php index 4c2fa01..12c0013 100644 --- a/database/seeders/AreaSeeder.php +++ b/database/seeders/AreaSeeder.php @@ -33,6 +33,24 @@ class AreaSeeder extends Seeder 'preview' => null, 'icon' => 'ri-ai-generate', ], + [ + 'name' => 'default_header', + 'valid_segments' => json_encode( + ["top", "header", "other", "ads", "menu"] + ), + 'max' => 2, + 'preview' => null, + 'icon' => 'ri-window-line', + ], + [ + 'name' => 'default_footer', + 'valid_segments' => json_encode( + ["footer", "other", "ads" , "groups"] + ), + 'max' => 2, + 'preview' => null, + 'icon' => 'ri-window-line rotate-180', + ], [ 'name' => 'index', 'valid_segments' => json_encode( @@ -71,7 +89,7 @@ class AreaSeeder extends Seeder "parallax", "other", "clip", "comments", "ads", "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-video-line', ], [ @@ -91,7 +109,7 @@ class AreaSeeder extends Seeder "parallax", "other", "gallery", "comments", "ads", "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-image-line', ], [ @@ -111,7 +129,7 @@ class AreaSeeder extends Seeder "parallax", "other", "product", "comments", "ads", "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-vip-diamond-line', ], [ @@ -131,7 +149,7 @@ class AreaSeeder extends Seeder "parallax", "other", "attachment", "comments", "ads"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-attachment-line', ], [ @@ -171,7 +189,7 @@ class AreaSeeder extends Seeder "parallax", "other", "group", "ads", 'posts_page', "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-book-shelf-line', ], // [ @@ -201,7 +219,7 @@ class AreaSeeder extends Seeder "parallax", "other", "login", "ads"] ), 'max' => 6, - 'preview' => 'client.login', + 'preview' => 'client.sign-in', 'icon' => 'ri-login-circle-line', ], [ @@ -252,6 +270,9 @@ class AreaSeeder extends Seeder $a->valid_segments = $area['valid_segments']; $a->icon = $area['icon']; $a->preview = $area['preview']; + if ($area['name'] == 'index'){ + $a->use_default = false; + } $a->save(); } } diff --git a/database/seeders/PartSeeder.php b/database/seeders/PartSeeder.php index fa7b561..364aa7e 100644 --- a/database/seeders/PartSeeder.php +++ b/database/seeders/PartSeeder.php @@ -83,37 +83,43 @@ class PartSeeder extends Seeder // ------------------------------------------------------------- - + // default header and footer $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'card')->first()->id; + $part->segment = 'menu'; + $part->part = 'AplMenu'; + $part->area_id = Area::where('name', 'index')->first()->id; $part->sort = 0; $part->save(); + $part = new Part(); - $part->segment = 'card'; - $part->part = 'NsCard'; - $part->area_id = Area::where('name', 'card')->first()->id; - $part->sort = 1; + $part->segment = 'header'; + $part->part = 'SimpleHeader'; + $part->area_id = Area::where('name', 'default_header')->first()->id; + $part->sort = 0; $part->save(); $part = new Part(); $part->segment = 'footer'; $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'card')->first()->id; + $part->area_id = Area::where('name', 'default_footer')->first()->id; $part->sort = 2; $part->save(); // ------------------------------------------------------------- $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'products-list')->first()->id; - $part->sort = 0; + $part->segment = 'card'; + $part->part = 'NsCard'; + $part->area_id = Area::where('name', 'card')->first()->id; + $part->sort = 1; $part->save(); + // ------------------------------------------------------------- + + + + $part = new Part(); $part->segment = 'products_page'; $part->part = 'ProductGridSidebar'; @@ -121,23 +127,12 @@ class PartSeeder extends Seeder $part->sort = 1; $part->save(); - $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'products-list')->first()->id; - $part->sort = 2; - $part->save(); + // ------------------------------------------------------------- - $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'product')->first()->id; - $part->sort = 0; - $part->save(); $part = new Part(); $part->segment = 'product'; @@ -146,60 +141,120 @@ class PartSeeder extends Seeder $part->sort = 1; $part->save(); + + + // ------------------------------------------------------------- + + + $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'product')->first()->id; - $part->sort = 2; + $part->segment = 'posts_page'; + $part->part = 'GridPostListSidebar'; + $part->area_id = Area::where('name', 'posts-list')->first()->id; + $part->sort = 1; $part->save(); + // ------------------------------------------------------------- + + $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'posts-list')->first()->id; - $part->sort = 0; + $part->segment = 'post'; + $part->part = 'PostSidebar'; + $part->area_id = Area::where('name', 'post')->first()->id; + $part->sort = 1; $part->save(); + + + // ------------------------------------------------------------- + + $part = new Part(); - $part->segment = 'posts_page'; - $part->part = 'GridPostListSidebar'; - $part->area_id = Area::where('name', 'posts-list')->first()->id; + $part->segment = 'clips_page'; + $part->part = 'ClipListGrid'; + $part->area_id = Area::where('name', 'clips-list')->first()->id; $part->sort = 1; $part->save(); + // ------------------------------------------------------------- + $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'posts-list')->first()->id; - $part->sort = 2; + $part->segment = 'clip'; + $part->part = 'DorClip'; + $part->area_id = Area::where('name', 'clip')->first()->id; + $part->sort = 1; $part->save(); // ------------------------------------------------------------- + $part = new Part(); + $part->segment = 'galleries_page'; + $part->part = 'GalleriesList'; + $part->area_id = Area::where('name', 'galleries-list')->first()->id; + $part->sort = 1; + $part->save(); + + + + // ------------------------------------------------------------- $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'post')->first()->id; - $part->sort = 0; + $part->segment = 'gallery'; + $part->part = 'GallaryGrid'; + $part->area_id = Area::where('name', 'gallery')->first()->id; + $part->sort = 1; $part->save(); + + + // ------------------------------------------------------------- + $part = new Part(); - $part->segment = 'post'; - $part->part = 'PostSidebar'; - $part->area_id = Area::where('name', 'post')->first()->id; + $part->segment = 'compare'; + $part->part = 'CompareProducts'; + $part->area_id = Area::where('name', 'compare')->first()->id; $part->sort = 1; $part->save(); + + // ------------------------------------------------------------- + $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'post')->first()->id; - $part->sort = 2; + $part->segment = 'login'; + $part->part = 'LoginPatternBg'; + $part->area_id = Area::where('name', 'login')->first()->id; + $part->sort = 1; + $part->save(); + + // ------------------------------------------------------------- + + $part = new Part(); + $part->segment = 'customer'; + $part->part = 'AvisaCustomer'; + $part->area_id = Area::where('name', 'customer')->first()->id; + $part->sort = 1; + $part->save(); + + // ------------------------------------------------------------- + + $part = new Part(); + $part->segment = 'attachments_page'; + $part->part = 'DenaAttachList'; + $part->area_id = Area::where('name', 'attachments-list')->first()->id; + $part->sort = 1; + $part->save(); + + // ------------------------------------------------------------- + + $part = new Part(); + $part->segment = 'attachment'; + $part->part = 'AttachmentWithPreview'; + $part->area_id = Area::where('name', 'attachment')->first()->id; + $part->sort = 1; $part->save(); diff --git a/resources/js/client.js b/resources/js/client.js index 082c06e..cbdbc41 100644 --- a/resources/js/client.js +++ b/resources/js/client.js @@ -14,24 +14,26 @@ import "./client-custom/windowLoader.js"; import "../views/segments/preloader/PreloaderCircle/PreloaderCircle.js"; import "../views/segments/menu/RecetMenu/RecetMenu.js"; import "../views/segments/slider/SliderSimple/SliderSimple.js"; +import "../views/segments/products/LatestProducts/LatestProducts.js"; import "../views/segments/posts/PostsIconSimple/PostsIconSimple.js"; import "../views/segments/index/CounterGrid/CounterGrid.js"; import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks.js"; import "../views/segments/posts/PostIndexImage/PostIndexImage.js"; import "../views/segments/footer/WaveFooter/WaveFooter.js"; +import "../views/segments/menu/AplMenu/AplMenu.js"; import "../views/segments/header/SimpleHeader/SimpleHeader.js"; -import "../views/segments/card/NsCard/NsCard.js"; import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; +import "../views/segments/card/NsCard/NsCard.js"; import "../views/segments/products_page/ProductGridSidebar/ProductGridSidebar.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; import "../views/segments/product/ProductKaren/ProductKaren.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; import "../views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; import "../views/segments/post/PostSidebar/PostSidebar.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/products/LatestProducts/LatestProducts.js"; +import "../views/segments/clips_page/ClipListGrid/ClipListGrid.js"; +import "../views/segments/clip/DorClip/DorClip.js"; +import "../views/segments/galleries_page/GalleriesList/GalleriesList.js"; +import "../views/segments/gallery/GallaryGrid/GallaryGrid.js"; +import "../views/segments/compare/CompareProducts/CompareProducts.js"; +import "../views/segments/login/LoginPatternBg/LoginPatternBg.js"; +import "../views/segments/customer/AvisaCustomer/AvisaCustomer.js"; +import "../views/segments/attachments_page/DenaAttachList/DenaAttachList.js"; +import "../views/segments/attachment/AttachmentWithPreview/AttachmentWithPreview.js"; diff --git a/resources/sass/client.scss b/resources/sass/client.scss index a56f232..ed562ca 100644 --- a/resources/sass/client.scss +++ b/resources/sass/client.scss @@ -25,24 +25,26 @@ $xshop-shadow:2px 2px 4px #777777; @import "../views/segments/preloader/PreloaderCircle/PreloaderCircle"; @import "../views/segments/menu/RecetMenu/RecetMenu"; @import "../views/segments/slider/SliderSimple/SliderSimple"; +@import "../views/segments/products/LatestProducts/LatestProducts"; @import "../views/segments/posts/PostsIconSimple/PostsIconSimple"; @import "../views/segments/index/CounterGrid/CounterGrid"; @import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks"; @import "../views/segments/posts/PostIndexImage/PostIndexImage"; @import "../views/segments/footer/WaveFooter/WaveFooter"; +@import "../views/segments/menu/AplMenu/AplMenu"; @import "../views/segments/header/SimpleHeader/SimpleHeader"; -@import "../views/segments/card/NsCard/NsCard"; @import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; +@import "../views/segments/card/NsCard/NsCard"; @import "../views/segments/products_page/ProductGridSidebar/ProductGridSidebar"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; @import "../views/segments/product/ProductKaren/ProductKaren"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; @import "../views/segments/posts_page/GridPostListSidebar/GridPostListSidebar"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; @import "../views/segments/post/PostSidebar/PostSidebar"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/products/LatestProducts/LatestProducts"; +@import "../views/segments/clips_page/ClipListGrid/ClipListGrid"; +@import "../views/segments/clip/DorClip/DorClip"; +@import "../views/segments/galleries_page/GalleriesList/GalleriesList"; +@import "../views/segments/gallery/GallaryGrid/GallaryGrid"; +@import "../views/segments/compare/CompareProducts/CompareProducts"; +@import "../views/segments/login/LoginPatternBg/LoginPatternBg"; +@import "../views/segments/customer/AvisaCustomer/AvisaCustomer"; +@import "../views/segments/attachments_page/DenaAttachList/DenaAttachList"; +@import "../views/segments/attachment/AttachmentWithPreview/AttachmentWithPreview"; diff --git a/resources/views/admin/areas/area-design.blade.php b/resources/views/admin/areas/area-design.blade.php index 2e34936..71e3347 100644 --- a/resources/views/admin/areas/area-design.blade.php +++ b/resources/views/admin/areas/area-design.blade.php @@ -14,6 +14,16 @@ {{__("Design :AREA",['AREA' => $area->name])}} + @if(strpos($area->name,'default') !== 0 ) + +
+ +
+ use_default) checked @endif type="checkbox" id="use_default"> + +
+
+ @endif get())' diff --git a/resources/views/client/category.blade.php b/resources/views/client/category.blade.php index 458e0d4..c19c860 100644 --- a/resources/views/client/category.blade.php +++ b/resources/views/client/category.blade.php @@ -10,9 +10,21 @@ if ($category->bg != null){ @endphp @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/default-list.blade.php b/resources/views/client/default-list.blade.php index e31f1c2..887eea9 100644 --- a/resources/views/client/default-list.blade.php +++ b/resources/views/client/default-list.blade.php @@ -5,9 +5,21 @@ @endsection @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/gallery.blade.php b/resources/views/client/gallery.blade.php index b5536e2..610fc06 100644 --- a/resources/views/client/gallery.blade.php +++ b/resources/views/client/gallery.blade.php @@ -5,9 +5,21 @@ @endsection @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData($gallery)) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/group.blade.php b/resources/views/client/group.blade.php index a181eb5..52a42d8 100644 --- a/resources/views/client/group.blade.php +++ b/resources/views/client/group.blade.php @@ -10,9 +10,21 @@ if ($group->bg != null){ @endphp @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/post.blade.php b/resources/views/client/post.blade.php index 81b78e0..7f1e2bc 100644 --- a/resources/views/client/post.blade.php +++ b/resources/views/client/post.blade.php @@ -5,10 +5,20 @@ {{$post->title}} - {{config('app.name')}} @endsection @section('content') -
+ @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData($post)) + @php($p = $part->getBladeWithData()) @include($p['blade'],['data' => $p['data']]) @endforeach -
+ @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif @endsection diff --git a/resources/views/client/welcome.blade.php b/resources/views/client/welcome.blade.php index d35ed59..376aa96 100644 --- a/resources/views/client/welcome.blade.php +++ b/resources/views/client/welcome.blade.php @@ -5,9 +5,21 @@ @endsection @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/segments/menu/RecetMenu/RecetMenu.scss b/resources/views/segments/menu/RecetMenu/RecetMenu.scss index 93f18ed..58dc2a8 100644 --- a/resources/views/segments/menu/RecetMenu/RecetMenu.scss +++ b/resources/views/segments/menu/RecetMenu/RecetMenu.scss @@ -1,5 +1,4 @@ #RecetMenu { - // scss position: fixed; inset-inline-start: 1rem; inset-inline-end: 1rem; diff --git a/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php b/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php index 71bba0d..52a5775 100644 --- a/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php +++ b/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php @@ -1,5 +1,6 @@
+ @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
@foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
@@ -24,6 +25,7 @@ @endforeach

+ @endif
diff --git a/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php b/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php index 75b5861..49c79e2 100644 --- a/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php +++ b/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php @@ -1,5 +1,6 @@
+ @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
@foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
@@ -24,6 +25,7 @@ @endforeach

+ @endif
@if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
diff --git a/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php b/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php index f3c4093..c4b0ec3 100644 --- a/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php +++ b/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php @@ -1,5 +1,6 @@
+ @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
@foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
@@ -24,6 +25,7 @@ @endforeach

+ @endif @foreach($posts as $post)
{{$post->title}} diff --git a/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php b/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php index cc2f27c..de47d18 100644 --- a/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php +++ b/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php @@ -1,27 +1,29 @@
- @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post) -
-
-
- {{$post->mainGroup->name}} -
- - {{$post->title}} - -
-

- {{$post->title}} -

- + @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 ) + @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post) +
+
+
+ {{$post->mainGroup->name}} +
+ + {{$post->title}} + +
+

+ {{$post->title}} +

+ {{$post->created_at->ldate('Y/m/d l')}} +
-
- @endforeach + @endforeach + @endif

diff --git a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php index c115265..a3a311d 100644 --- a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php +++ b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php @@ -4,14 +4,14 @@
-
+
{!! $slider->body !!}

{{$slider->dataz['index_ParallaxSlider_subtitle']}}
+ href="{{fixUrlLang($slider->dataz['index_ParallaxSlider_link'])}}"> {{$slider->dataz['index_ParallaxSlider_btn']}}

diff --git a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss index ae64ba6..dd0211d 100644 --- a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss +++ b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss @@ -1,5 +1,10 @@ #ParallaxSlider { + .tns-inner{ + direction: ltr; + } + + #ParallaxSliderTns > div{ position: relative; overflow: hidden; From 8d9efa1f550126cc8c0c9cd4f85d8675f1ba8910 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 20 Aug 2024 06:00:57 +0330 Subject: [PATCH 03/15] fixed bug --- app/Http/Controllers/Admin/CustomerController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/CustomerController.php b/app/Http/Controllers/Admin/CustomerController.php index 8bc85d0..b2afa2e 100644 --- a/app/Http/Controllers/Admin/CustomerController.php +++ b/app/Http/Controllers/Admin/CustomerController.php @@ -51,7 +51,7 @@ class CustomerController extends XController { $customer->name = $request->input('name'); - if ($customer->credit != $request->input('credit')){ + if ($customer->credit != $request->input('credit') && $customer->id != null){ $diff = $request->input('credit') - $customer->credit; $customer->credit = $request->input('credit')??0 ; $cr = new Credit(); From 5d807f11683ea31966ad0bd38fb822e01c7791b0 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Wed, 21 Aug 2024 21:02:01 +0330 Subject: [PATCH 04/15] fixed bug ui apl menu --- resources/views/segments/menu/AplMenu/AplMenu.scss | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/views/segments/menu/AplMenu/AplMenu.scss b/resources/views/segments/menu/AplMenu/AplMenu.scss index 9bc78f1..f56215a 100644 --- a/resources/views/segments/menu/AplMenu/AplMenu.scss +++ b/resources/views/segments/menu/AplMenu/AplMenu.scss @@ -1,6 +1,3 @@ -main{ - padding-top: 47px; -} #AplMenu { position: fixed; left: 0; From 1b47932a06d18511fe1b5b9564a687e978e48d09 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Sun, 25 Aug 2024 23:24:35 +0330 Subject: [PATCH 05/15] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bef485a..9360590 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ ## Access to xShop/v1 > [!WARNING] -> xShop/v1 available here: https://github.com/a1Gard/xshop.v1 +> xShop/v1 available here: https://github.com/4xmen/xshop.v1 ## Installation From b7665af6006fc382fd5b1496f5d80bad5d42b7dd Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 00:41:18 +0330 Subject: [PATCH 06/15] added client web page test --- app/Helpers/Helper.php | 57 ++++++++++---- app/Http/Controllers/Admin/AreaController.php | 2 - database/seeders/PartSeeder.php | 2 +- .../segments/menu/AplMenu/AplMenu.blade.php | 2 +- .../views/segments/menu/AplMenu/AplMenu.scss | 4 + .../menu/RecetMenu/RecetMenu.blade.php | 2 +- .../PostIndexImage/PostIndexImage.blade.php | 8 +- .../PostsIconSimple/PostsIconSimple.blade.php | 8 +- tests/Feature/ClientWebPagesTest.php | 75 +++++++++++++++++++ tests/Feature/ExampleTest.php | 7 +- tests/Unit/ExampleTest.php | 16 ---- 11 files changed, 140 insertions(+), 43 deletions(-) create mode 100644 tests/Feature/ClientWebPagesTest.php delete mode 100644 tests/Unit/ExampleTest.php diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index c2801a1..d7cedae 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -816,25 +816,48 @@ function getGroupBySetting($key) } /** - * get group by setting key + * get menu by setting key * @param $key * @return Menu */ function getMenuBySetting($key) { + if (Menu::count() == 0) { + return []; + } return Menu::where('id', getSetting($key) ?? 1)->first(); } +/** + * get menu's items by setting key + * @param $key + * @return array + */ +function getMenuBySettingItems($key) +{ + if (Menu::count() == 0) { + return []; + } + $r = Menu::where('id', getSetting($key) ?? 1)->first(); + if ($r == null) { + $r = Menu::first(); + } + return $r->items; +} + /** * get group's posts by setting key * @param $key * @param integer $limit - * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C + * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C|array */ function getGroupPostsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC") { - return Group::where('id', getSetting($key) ?? 1)->first() - ->posts()->where('status', 1)->orderBy($order, $dir)->limit($limit)->get(); + $g = Group::where('id', getSetting($key) ?? 1)->first(); + if ($g == null) { + return []; + } + return $g->posts()->where('status', 1)->orderBy($order, $dir)->limit($limit)->get(); } /** @@ -857,12 +880,15 @@ function getCategoryProductBySetting($key, $limit = 10, $order = 'id', $dir = "D * @param integer $limit * @param string $order * @param string $dir - * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C + * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C | array */ function getCategorySubCatsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC") { - return Category::where('id', getSetting($key) ?? 1)->first() - ->children()->orderBy($order, $dir)->limit($limit)->get(); + $c = Category::where('id', getSetting($key) ?? 1)->first(); + if ($c == null) { + return []; + } + return $c->children()->orderBy($order, $dir)->limit($limit)->get(); } /** @@ -994,6 +1020,7 @@ function postsUrl() { return fixUrlLang(\route('client.posts')); } + /** * products url to best experience for multi lang shops * @return string @@ -1002,6 +1029,7 @@ function productsUrl() { return fixUrlLang(\route('client.products')); } + /** * clips url to best experience for multi lang shops * @return string @@ -1010,6 +1038,7 @@ function clipsUrl() { return fixUrlLang(\route('client.clips')); } + /** * galleries url to best experience for multi lang shops * @return string @@ -1018,6 +1047,7 @@ function gallariesUrl() { return fixUrlLang(\route('client.galleries')); } + /** * attachments url to best experience for multi lang shops * @return string @@ -1101,11 +1131,11 @@ function transports() */ function defTrannsport() { - if (\App\Models\Transport::where('is_default',1)->count() == 0){ + if (\App\Models\Transport::where('is_default', 1)->count() == 0) { return null; } - return \App\Models\Transport::where('is_default',1)->first()->id; + return \App\Models\Transport::where('is_default', 1)->first()->id; } @@ -1114,7 +1144,8 @@ function defTrannsport() * @param $array * @return false|string */ -function vueTranslate($array){ +function vueTranslate($array) +{ return json_encode($array); } @@ -1137,7 +1168,7 @@ function markUpBreadcrumbList($items) "name" => $index, ]; if ($item != '' || $item != null) { - $json[$i-1]['item'] = $item; + $json[$i - 1]['item'] = $item; } } @@ -1166,9 +1197,9 @@ RESULT; */ function fixUrlLang($url) { - if ( config('app.xlang.active') && app()->getLocale() != config('app.xlang.main')){ + if (config('app.xlang.active') && app()->getLocale() != config('app.xlang.main')) { $welcome = \route('client.welcome'); - return str_replace($welcome,$welcome .'/'.app()->getLocale(),$url); + return str_replace($welcome, $welcome . '/' . app()->getLocale(), $url); } return $url; } diff --git a/app/Http/Controllers/Admin/AreaController.php b/app/Http/Controllers/Admin/AreaController.php index 6d7ba1e..3f4b6b0 100644 --- a/app/Http/Controllers/Admin/AreaController.php +++ b/app/Http/Controllers/Admin/AreaController.php @@ -20,8 +20,6 @@ class AreaController extends Controller public function desgin(Area $area) { - - $valids = []; foreach ($area->segment as $seg) { if (File::exists(resource_path() . '/views/segments/' . $seg)) { diff --git a/database/seeders/PartSeeder.php b/database/seeders/PartSeeder.php index 364aa7e..eca39b4 100644 --- a/database/seeders/PartSeeder.php +++ b/database/seeders/PartSeeder.php @@ -87,7 +87,7 @@ class PartSeeder extends Seeder $part = new Part(); $part->segment = 'menu'; $part->part = 'AplMenu'; - $part->area_id = Area::where('name', 'index')->first()->id; + $part->area_id = Area::where('name', 'default_header')->first()->id; $part->sort = 0; $part->save(); diff --git a/resources/views/segments/menu/AplMenu/AplMenu.blade.php b/resources/views/segments/menu/AplMenu/AplMenu.blade.php index 4fb6eae..9955c99 100644 --- a/resources/views/segments/menu/AplMenu/AplMenu.blade.php +++ b/resources/views/segments/menu/AplMenu/AplMenu.blade.php @@ -7,7 +7,7 @@ - @foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item) + @foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
  • @if($item->meta == null) diff --git a/resources/views/segments/menu/AplMenu/AplMenu.scss b/resources/views/segments/menu/AplMenu/AplMenu.scss index f56215a..470452f 100644 --- a/resources/views/segments/menu/AplMenu/AplMenu.scss +++ b/resources/views/segments/menu/AplMenu/AplMenu.scss @@ -146,4 +146,8 @@ } } } + + ~header{ + margin-top: 44px; + } } diff --git a/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php b/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php index bdd629d..31696be 100644 --- a/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php +++ b/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php @@ -5,7 +5,7 @@
  • - @foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item) + @foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
  • {{$item->title}} diff --git a/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php b/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php index 20979c5..7da1696 100644 --- a/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php +++ b/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php @@ -1,12 +1,12 @@

    - - {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->name}} + + {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->name}}

    - {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->description}} + {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->description}}

    @foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',4) as $post ) @@ -28,7 +28,7 @@ @endforeach
    diff --git a/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php b/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php index 2917c64..bf0bcf7 100755 --- a/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php +++ b/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php @@ -1,12 +1,12 @@

    - - {{getGroupBySetting($data->area->name.'_'.$data->part)->name}} + + {{getGroupBySetting($data->area->name.'_'.$data->part)?->name}}

    - {{getGroupBySetting($data->area->name.'_'.$data->part)->description}} + {{getGroupBySetting($data->area->name.'_'.$data->part)?->description}}

    @foreach(getGroupPostsBySetting($data->area->name.'_'.$data->part, getSetting($data->area->name.'_'.$data->part.'_limit')) as $post) @@ -20,7 +20,7 @@ {{$post->subtitle}}

    - + {{__("Read more")}}
    diff --git a/tests/Feature/ClientWebPagesTest.php b/tests/Feature/ClientWebPagesTest.php new file mode 100644 index 0000000..d404ff8 --- /dev/null +++ b/tests/Feature/ClientWebPagesTest.php @@ -0,0 +1,75 @@ +get(route('client.welcome')); + + $response->assertStatus(200); + } + + public function test_web_client_posts(): void + { + $response = $this->get(route('client.posts')); + + $response->assertStatus(200); + } + + public function test_web_client_products(): void + { + $response = $this->get(route('client.products')); + + $response->assertStatus(200); + } + + public function test_web_client_product(): void + { + + if (Product::count() == 0) { + Product::factory(1)->create(); + } + $response = $this->get(Product::first()->webUrl()); + $response->assertStatus(200); + } + + public function test_web_client_post(): void + { + + if (Post::count() == 0) { + Post::factory(1)->create(); + } + $response = $this->get(Post::first()->webUrl()); + $response->assertStatus(200); + } + + public function test_web_client_group(): void + { + + if (Group::count() == 0) { + Group::factory(1)->create(); + } + $response = $this->get(Group::first()->webUrl()); + $response->assertStatus(200); + } + public function test_web_client_category(): void + { + + if (Category::count() == 0) { + Category::factory(1)->create(); + } + $response = $this->get(Category::first()->webUrl()); + $response->assertStatus(200); + } +} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index 8364a84..bf9ba1d 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -3,17 +3,22 @@ namespace Tests\Feature; // use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Support\Facades\Log; use Tests\TestCase; class ExampleTest extends TestCase { + /** * A basic test example. */ public function test_the_application_returns_a_successful_response(): void { - $response = $this->get('/'); + + $response = $this->get(route('client.welcome')); $response->assertStatus(200); + } } diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php deleted file mode 100644 index 5773b0c..0000000 --- a/tests/Unit/ExampleTest.php +++ /dev/null @@ -1,16 +0,0 @@ -assertTrue(true); - } -} From 2ea6356c53d53fcca594f0f553a77fbdc3375745 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 00:48:04 +0330 Subject: [PATCH 07/15] added siemap and customer test --- routes/web.php | 2 +- tests/Feature/CustomerTest.php | 29 +++++++++++++++++++++++++++++ tests/Feature/SiteMapTest.php | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/CustomerTest.php create mode 100644 tests/Feature/SiteMapTest.php diff --git a/routes/web.php b/routes/web.php index 8b1e9d2..faecfb4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -357,7 +357,7 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group( }); -Route::get('theme/variable.css', [\App\Http\Controllers\ThemeController::class, 'cssVariables'])->name('theme.variable.css'); +Route::get('/theme/variable', [\App\Http\Controllers\ThemeController::class, 'cssVariables'])->name('theme.variable.css'); Route::middleware([\App\Http\Middleware\VisitorCounter::class]) ->name('client.')->group(function () { diff --git a/tests/Feature/CustomerTest.php b/tests/Feature/CustomerTest.php new file mode 100644 index 0000000..5843d93 --- /dev/null +++ b/tests/Feature/CustomerTest.php @@ -0,0 +1,29 @@ +create(); + } + } + /** + * A basic feature test example. + */ + public function test_customer_profile(): void + { + + $this->check(); + $response = $this->actingAs(Customer::inRandomOrder()->first(),'customer')->get(route('client.profile')); + + $response->assertStatus(200); + } +} diff --git a/tests/Feature/SiteMapTest.php b/tests/Feature/SiteMapTest.php new file mode 100644 index 0000000..5d8e7ff --- /dev/null +++ b/tests/Feature/SiteMapTest.php @@ -0,0 +1,20 @@ +get(route('sitemap')); + + $response->assertStatus(200); + } +} From b6fe85bb2ba3c6e8a1ba89b541d9d4ebe1538e80 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 00:50:01 +0330 Subject: [PATCH 08/15] added github test --- .github/workflows/laravel.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/laravel.yml diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml new file mode 100644 index 0000000..15b74b1 --- /dev/null +++ b/.github/workflows/laravel.yml @@ -0,0 +1,42 @@ +name: Laravel + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + laravel-tests: + + runs-on: ubuntu-latest + + steps: + - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e + with: + php-version: '8.1' + - uses: actions/checkout@v3 + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + - name: remove composer lock + run: rm composer.lock + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --ignore-platform-reqs + - name: Generate key + run: php artisan key:generate + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + - name: Create Database + run: | + mkdir -p database + touch database/database.sqlite + - name: Dataseeder + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite + run: php artisan migrate --seed + - name: Execute tests (Unit and Feature tests) via PHPUnit + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite + run: php artisan test From f9962539504ee06b7c6a37bbb6c4a75388fde5cf Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 00:54:05 +0330 Subject: [PATCH 09/15] updated github test --- .github/workflows/laravel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 15b74b1..f123974 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e with: - php-version: '8.1' + php-version: '8.2' - uses: actions/checkout@v3 - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" From 07f13ca078651a344a25cd16ef63961365e069ff Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 00:59:47 +0330 Subject: [PATCH 10/15] fixed test --- .../segments/attachments_page/DenaAttachList/DenaAttachList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php b/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php index b2bd50d..fcddf52 100644 --- a/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php +++ b/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php @@ -12,7 +12,7 @@ class DenaAttachList $setting = new Setting(); $setting->section = 'theme'; $setting->key = $part->area->name . '_' . $part->part.'_title'; - $setting->value = __("Website attachments list").' [ pdf, docx, zip, png, jpg, svg, mp4, rar, mp3 ]'; + $setting->value = __("Website attachments list"); $setting->type = 'text'; $setting->size = 6; $setting->title = $part->area->name . ' ' . $part->part; From e8860ab0860590b3382e69803b3c343da38827d7 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 01:10:05 +0330 Subject: [PATCH 11/15] fixed bug dena theme --- .../attachments_page/DenaAttachList/DenaAttachList.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php b/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php index fcddf52..73df08b 100644 --- a/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php +++ b/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php @@ -12,8 +12,8 @@ class DenaAttachList $setting = new Setting(); $setting->section = 'theme'; $setting->key = $part->area->name . '_' . $part->part.'_title'; - $setting->value = __("Website attachments list"); - $setting->type = 'text'; + $setting->value = __("Website attachments list").' [ pdf, docx, zip, png, jpg, svg, mp4, rar, mp3 ]'; + $setting->type = 'TEXT'; $setting->size = 6; $setting->title = $part->area->name . ' ' . $part->part; $setting->save(); From f74c979e9550eb1488a90504ace42681e26c3de3 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 01:16:01 +0330 Subject: [PATCH 12/15] added sample test unit --- tests/Unit/SampleTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/Unit/SampleTest.php diff --git a/tests/Unit/SampleTest.php b/tests/Unit/SampleTest.php new file mode 100644 index 0000000..9e2b25e --- /dev/null +++ b/tests/Unit/SampleTest.php @@ -0,0 +1,16 @@ +assertTrue(true); + } +} From f81688a0fa97637f56478680496355b8cd220ff5 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 01:21:40 +0330 Subject: [PATCH 13/15] fixed visitor counter middleware --- app/Helpers/TVisitor.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Helpers/TVisitor.php b/app/Helpers/TVisitor.php index 1b811aa..1e669da 100644 --- a/app/Helpers/TVisitor.php +++ b/app/Helpers/TVisitor.php @@ -44,7 +44,7 @@ class TVisitor { */ public static function DetectOS() { if (!isset($_SERVER['HTTP_USER_AGENT'])) - return 'Unknown'; + return null; $os_list = Visitor::$osList; @@ -54,7 +54,7 @@ class TVisitor { } } - return 'Unknown'; + return null; } /** @@ -118,7 +118,7 @@ class TVisitor { */ public static function DetectBrowser() { if (!isset($_SERVER['HTTP_USER_AGENT'])) - return 'Unknown'; + return null; $browser_list = Visitor::$browserList; @@ -128,7 +128,7 @@ class TVisitor { } } - return 'Other'; + return null; } /** From fb64ad1403ac816cc1885cca81676dfc65fe2333 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 01:30:37 +0330 Subject: [PATCH 14/15] added node to workflow test --- .github/workflows/laravel.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index f123974..a673873 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -16,6 +16,9 @@ jobs: with: php-version: '8.2' - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '18' - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" - name: remove composer lock @@ -35,6 +38,12 @@ jobs: DB_CONNECTION: sqlite DB_DATABASE: database/database.sqlite run: php artisan migrate --seed + - name: Npm install + run: npm install + - name: client build + run: php artisan client + - name: npm build + run: npm run build - name: Execute tests (Unit and Feature tests) via PHPUnit env: DB_CONNECTION: sqlite From 974c2b9390ed35abfabb4892da8cbbeb21efe92a Mon Sep 17 00:00:00 2001 From: A1Gard Date: Mon, 26 Aug 2024 01:33:47 +0330 Subject: [PATCH 15/15] fixed error --- .github/workflows/laravel.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index a673873..e46f7ac 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -41,6 +41,9 @@ jobs: - name: Npm install run: npm install - name: client build + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite run: php artisan client - name: npm build run: npm run build