Compare commits

..

2 Commits

Author SHA1 Message Date
Mekan1206
c23d0eeab0 downgrade 2026-05-04 13:37:25 +05:00
Mekan1206
14b47d40e8 WIP 2026-05-04 13:34:54 +05:00
2 changed files with 29 additions and 29 deletions

View File

@@ -46,7 +46,7 @@ class FilterController extends Controller
}
if ($this->shouldFilterByCollection()) {
return $this->categoriesFor();
return $this->categoriesFor($this->request->collection_id, 'collection');
}
if ($this->shouldFilterByBrand()) {
@@ -54,7 +54,7 @@ class FilterController extends Controller
}
if ($this->shouldFilterByChannel()) {
return $this->filterByCategoryResource(Channel::find($this->request->channel_id));
return $this->filterByCategoryResource($this->request->channel_id, 'category');
}
return Category::query()->where('is_visible', true)->ordered()->get(['id', 'parent_id', 'name']);
@@ -115,20 +115,20 @@ class FilterController extends Controller
/**
* Categories for a resource
*/
private function categoriesFor($resource)
private function categoriesFor(int $id, string $type)
{
return DB::table('categories as c')
->select('c.id', 'c.parent_id', 'c.name')
->where('c.is_visible', true)
->whereExists(function ($query) {
->whereExists(function ($query) use ($id, $type) {
$query->select(DB::raw(1))
->from('product_has_relations as phr_cat')
->join('products as p', 'p.id', '=', 'phr_cat.product_id')
->join('product_has_relations as phr_chan', 'phr_chan.product_id', '=', 'p.id')
->whereColumn('phr_cat.productable_id', 'c.id')
->where('phr_cat.productable_type', 'category')
->where('phr_chan.productable_type', 'channel')
->where('phr_chan.productable_id', 6)
->where('phr_chan.productable_type', $type)
->where('phr_chan.productable_id', $id)
->where('p.is_visible', true)
->whereNull('p.parent_id')
->where('p.stock', '>', 0);

46
composer.lock generated
View File

@@ -3307,31 +3307,31 @@
},
{
"name": "maennchen/zipstream-php",
"version": "3.2.2",
"version": "3.1.2",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "77bebeb4c6c340bb3c11c843b2cffd8bbfde4d5e"
"reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/77bebeb4c6c340bb3c11c843b2cffd8bbfde4d5e",
"reference": "77bebeb4c6c340bb3c11c843b2cffd8bbfde4d5e",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/aeadcf5c412332eb426c0f9b4485f6accba2a99f",
"reference": "aeadcf5c412332eb426c0f9b4485f6accba2a99f",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-zlib": "*",
"php-64bit": "^8.3"
"php-64bit": "^8.2"
},
"require-dev": {
"brianium/paratest": "^7.7",
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.86",
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^12.0",
"phpunit/phpunit": "^11.0",
"vimeo/psalm": "^6.0"
},
"suggest": {
@@ -3373,7 +3373,7 @@
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.2.2"
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.2"
},
"funding": [
{
@@ -3381,7 +3381,7 @@
"type": "github"
}
],
"time": "2026-04-11T18:38:28+00:00"
"time": "2025-01-27T12:07:53+00:00"
},
{
"name": "markbaker/complex",
@@ -4359,16 +4359,16 @@
},
{
"name": "openspout/openspout",
"version": "v4.32.0",
"version": "v4.28.5",
"source": {
"type": "git",
"url": "https://github.com/openspout/openspout.git",
"reference": "41f045c1f632e1474e15d4c7bc3abcb4a153563d"
"reference": "ab05a09fe6fce57c90338f83280648a9786ce36b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/openspout/openspout/zipball/41f045c1f632e1474e15d4c7bc3abcb4a153563d",
"reference": "41f045c1f632e1474e15d4c7bc3abcb4a153563d",
"url": "https://api.github.com/repos/openspout/openspout/zipball/ab05a09fe6fce57c90338f83280648a9786ce36b",
"reference": "ab05a09fe6fce57c90338f83280648a9786ce36b",
"shasum": ""
},
"require": {
@@ -4378,17 +4378,17 @@
"ext-libxml": "*",
"ext-xmlreader": "*",
"ext-zip": "*",
"php": "~8.3.0 || ~8.4.0 || ~8.5.0"
"php": "~8.2.0 || ~8.3.0 || ~8.4.0"
},
"require-dev": {
"ext-zlib": "*",
"friendsofphp/php-cs-fixer": "^3.86.0",
"infection/infection": "^0.31.2",
"phpbench/phpbench": "^1.4.1",
"phpstan/phpstan": "^2.1.22",
"phpstan/phpstan-phpunit": "^2.0.7",
"phpstan/phpstan-strict-rules": "^2.0.6",
"phpunit/phpunit": "^12.3.7"
"friendsofphp/php-cs-fixer": "^3.68.3",
"infection/infection": "^0.29.10",
"phpbench/phpbench": "^1.4.0",
"phpstan/phpstan": "^2.1.2",
"phpstan/phpstan-phpunit": "^2.0.4",
"phpstan/phpstan-strict-rules": "^2",
"phpunit/phpunit": "^11.5.4"
},
"suggest": {
"ext-iconv": "To handle non UTF-8 CSV files (if \"php-mbstring\" is not already installed or is too limited)",
@@ -4436,7 +4436,7 @@
],
"support": {
"issues": "https://github.com/openspout/openspout/issues",
"source": "https://github.com/openspout/openspout/tree/v4.32.0"
"source": "https://github.com/openspout/openspout/tree/v4.28.5"
},
"funding": [
{
@@ -4448,7 +4448,7 @@
"type": "github"
}
],
"time": "2025-09-03T16:03:54+00:00"
"time": "2025-01-30T13:51:11+00:00"
},
{
"name": "outl1ne/nova-multiselect-field",