Compare commits

..

No commits in common. '974c2b9390ed35abfabb4892da8cbbeb21efe92a' and '5d807f11683ea31966ad0bd38fb822e01c7791b0' have entirely different histories.

@ -1,54 +0,0 @@
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.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
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: 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
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test

@ -20,7 +20,7 @@
## Access to xShop/v1
> [!WARNING]
> xShop/v1 available here: <a href="https://github.com/4xmen/xshop.v1">https://github.com/4xmen/xshop.v1</a>
> xShop/v1 available here: <a href="https://github.com/a1Gard/xshop.v1">https://github.com/a1Gard/xshop.v1</a>
## Installation

@ -816,48 +816,25 @@ function getGroupBySetting($key)
}
/**
* get menu by setting key
* get group 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|array
* @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C
*/
function getGroupPostsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC")
{
$g = Group::where('id', getSetting($key) ?? 1)->first();
if ($g == null) {
return [];
}
return $g->posts()->where('status', 1)->orderBy($order, $dir)->limit($limit)->get();
return Group::where('id', getSetting($key) ?? 1)->first()
->posts()->where('status', 1)->orderBy($order, $dir)->limit($limit)->get();
}
/**
@ -880,15 +857,12 @@ 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 | array
* @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C
*/
function getCategorySubCatsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC")
{
$c = Category::where('id', getSetting($key) ?? 1)->first();
if ($c == null) {
return [];
}
return $c->children()->orderBy($order, $dir)->limit($limit)->get();
return Category::where('id', getSetting($key) ?? 1)->first()
->children()->orderBy($order, $dir)->limit($limit)->get();
}
/**
@ -1020,7 +994,6 @@ function postsUrl()
{
return fixUrlLang(\route('client.posts'));
}
/**
* products url to best experience for multi lang shops
* @return string
@ -1029,7 +1002,6 @@ function productsUrl()
{
return fixUrlLang(\route('client.products'));
}
/**
* clips url to best experience for multi lang shops
* @return string
@ -1038,7 +1010,6 @@ function clipsUrl()
{
return fixUrlLang(\route('client.clips'));
}
/**
* galleries url to best experience for multi lang shops
* @return string
@ -1047,7 +1018,6 @@ function gallariesUrl()
{
return fixUrlLang(\route('client.galleries'));
}
/**
* attachments url to best experience for multi lang shops
* @return string
@ -1144,8 +1114,7 @@ function defTrannsport()
* @param $array
* @return false|string
*/
function vueTranslate($array)
{
function vueTranslate($array){
return json_encode($array);
}

@ -44,7 +44,7 @@ class TVisitor {
*/
public static function DetectOS() {
if (!isset($_SERVER['HTTP_USER_AGENT']))
return null;
return 'Unknown';
$os_list = Visitor::$osList;
@ -54,7 +54,7 @@ class TVisitor {
}
}
return null;
return 'Unknown';
}
/**
@ -118,7 +118,7 @@ class TVisitor {
*/
public static function DetectBrowser() {
if (!isset($_SERVER['HTTP_USER_AGENT']))
return null;
return 'Unknown';
$browser_list = Visitor::$browserList;
@ -128,7 +128,7 @@ class TVisitor {
}
}
return null;
return 'Other';
}
/**

@ -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)) {

@ -87,7 +87,7 @@ class PartSeeder extends Seeder
$part = new Part();
$part->segment = 'menu';
$part->part = 'AplMenu';
$part->area_id = Area::where('name', 'default_header')->first()->id;
$part->area_id = Area::where('name', 'index')->first()->id;
$part->sort = 0;
$part->save();

@ -13,7 +13,7 @@ class DenaAttachList
$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->type = 'TEXT';
$setting->type = 'text';
$setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part;
$setting->save();

@ -7,7 +7,7 @@
</a>
</li>
@foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
@foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item)
<li>
@if($item->meta == null)
<a href="{{$item->webUrl()}}">

@ -146,8 +146,4 @@
}
}
}
~header{
margin-top: 44px;
}
}

@ -5,7 +5,7 @@
<i class="ri-menu-line"></i>
</a>
</li>
@foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
@foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item)
<li>
<a href="{{$item->webUrl()}}">
{{$item->title}}

@ -1,12 +1,12 @@
<section class='PostIndexImage'>
<div class="{{gfx()['container']}}">
<h1>
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->webUrl()}}">
{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->name}}
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->webUrl()}}">
{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->name}}
</a>
</h1>
<p class="text-muted">
{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->description}}
{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->description}}
</p>
<div class="row">
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',4) as $post )
@ -28,7 +28,7 @@
@endforeach
</div>
<div class="py-5 text-center">
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->webUrl()}}" class="btn btn-outline-primary">
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->webUrl()}}" class="btn btn-outline-primary">
{{getSetting($data->area->name.'_'.$data->part.'_btn')}}
</a>
</div>

@ -1,12 +1,12 @@
<section class='PostsIconSimple py-4'>
<div class="{{gfx()['container']}}">
<h1>
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part)?->webUrl()}}">
{{getGroupBySetting($data->area->name.'_'.$data->part)?->name}}
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part)->webUrl()}}">
{{getGroupBySetting($data->area->name.'_'.$data->part)->name}}
</a>
</h1>
<p>
{{getGroupBySetting($data->area->name.'_'.$data->part)?->description}}
{{getGroupBySetting($data->area->name.'_'.$data->part)->description}}
</p>
<div class="row">
@foreach(getGroupPostsBySetting($data->area->name.'_'.$data->part, getSetting($data->area->name.'_'.$data->part.'_limit')) as $post)
@ -20,7 +20,7 @@
{{$post->subtitle}}
</p>
<a href="{{$post?->webUrl()}}" class="btn btn-outline-primary w-100">
<a href="{{$post->webUrl()}}" class="btn btn-outline-primary w-100">
{{__("Read more")}}
</a>
</div>

@ -357,7 +357,7 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group(
});
Route::get('/theme/variable', [\App\Http\Controllers\ThemeController::class, 'cssVariables'])->name('theme.variable.css');
Route::get('theme/variable.css', [\App\Http\Controllers\ThemeController::class, 'cssVariables'])->name('theme.variable.css');
Route::middleware([\App\Http\Middleware\VisitorCounter::class])
->name('client.')->group(function () {

@ -1,75 +0,0 @@
<?php
namespace Tests\Feature;
use App\Models\Category;
use App\Models\Group;
use App\Models\Post;
use App\Models\Product;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class ClientWebPagesTest extends TestCase
{
public function test_web_client_index(): void
{
$response = $this->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);
}
}

@ -1,29 +0,0 @@
<?php
namespace Tests\Feature;
use App\Models\Customer;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class CustomerTest extends TestCase
{
public function check(){
if (Customer::count() == 0){
Customer::factory(1)->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);
}
}

@ -3,22 +3,17 @@
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(route('client.welcome'));
$response = $this->get('/');
$response->assertStatus(200);
}
}

@ -1,20 +0,0 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class SiteMapTest extends TestCase
{
/**
* A basic feature test example.
*/
public function test_sitemap(): void
{
$response = $this->get(route('sitemap'));
$response->assertStatus(200);
}
}

@ -4,12 +4,12 @@ namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class SampleTest extends TestCase
class ExampleTest extends TestCase
{
/**
* A basic unit test example.
* A basic test example.
*/
public function test_example(): void
public function test_that_true_is_true(): void
{
$this->assertTrue(true);
}
Loading…
Cancel
Save