diff --git a/app/Http/Views/ActivityFilterScope.php b/app/Http/Views/ActivityFilterScope.php index 474f4e12..e3b412e1 100644 --- a/app/Http/Views/ActivityFilterScope.php +++ b/app/Http/Views/ActivityFilterScope.php @@ -3,6 +3,7 @@ namespace App\Http\Views; use App\Activity; +use App\Lib\Filter; use Illuminate\Database\Eloquent\Builder; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\MapOutputName; @@ -42,4 +43,3 @@ class ActivityFilterScope extends Filter return $query; } } - diff --git a/app/Http/Views/Filter.php b/app/Http/Views/Filter.php deleted file mode 100644 index e713d0ef..00000000 --- a/app/Http/Views/Filter.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ - abstract protected function locks(): array; - - public static function fromRequest(?string $request = null): static - { - $parameters = json_decode(base64_decode($request), true); - - return static::from($parameters ?: [])->parseLocks(); - } - - public function parseLocks(): static - { - foreach ($this->locks() as $key => $value) { - if ($value === $this->unsetReplacer) { - continue; - } - - $this->{$key} = $value; - } - - return $this; - } - - /** - * @param mixed $value - * - * @return mixed - */ - public function when(bool $when, $value) - { - return $when ? $value : $this->unsetReplacer; - } - - /** - * @param Builder $query - * - * @return Builder - */ - protected function applyOwnOthers(Builder $query, bool $own, bool $others): Builder - { - if ($own && !$others) { - $query->where('user_id', auth()->id()); - } - - if (!$own && $others) { - $query->where('user_id', '!=', auth()->id()); - } - - if (!$own && !$others) { - $query->where('id', -1); - } - - return $query; - } -}