Skip to content

Commit 15dc878

Browse files
committed
Merge branch 'develop'
* develop: hotfix: Navigation page have error with contentPicker
2 parents 353ddbd + a50547a commit 15dc878

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace SolutionForest\InspireCms\Filament\Forms\Components\ContentTree\Filter;
4+
5+
class WithoutGlobalScope extends BaseFilter
6+
{
7+
public function __construct(
8+
protected string $scopeClass,
9+
) {}
10+
11+
public function toLivewire()
12+
{
13+
return [
14+
'scopeClass' => $this->scopeClass,
15+
];
16+
}
17+
18+
public static function fromLivewire($value)
19+
{
20+
return new static($value['scopeClass']);
21+
}
22+
23+
public function applyToQuery($query)
24+
{
25+
$query->withoutGlobalScope($this->scopeClass);
26+
27+
return $query;
28+
}
29+
}

src/Filament/Resources/NavigationResource.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Filament\Tables\Table;
1111
use Illuminate\Database\Eloquent\Builder;
1212
use Illuminate\Database\Eloquent\Model;
13+
use Illuminate\Database\Eloquent\SoftDeletingScope;
1314
use SolutionForest\InspireCms\Base\Enums\NavigationType;
1415
use SolutionForest\InspireCms\Facades\InspireCms;
1516
use SolutionForest\InspireCms\Filament\Clusters\Settings;
@@ -209,7 +210,7 @@ protected static function getContentFormComponent()
209210
null;
210211
})
211212
// display deleted content
212-
->where(new ContentPickerFilters\BuilderFilter('withTrashed'));
213+
->where(new ContentPickerFilters\WithoutGlobalScope(SoftDeletingScope::class));
213214
}
214215

215216
/**

0 commit comments

Comments
 (0)