This commit is contained in:
F4ilji
2026-04-07 17:54:26 +05:00
parent 04adba6682
commit 936b1fb5b0
468 changed files with 43498 additions and 4176 deletions
@@ -0,0 +1,18 @@
<?php
namespace App\Containers\Dashboard\Actions\PageReferenceLists;
use App\Containers\Widget\Models\PageReferenceList;
use Illuminate\Support\Str;
class CreatePageReferenceListAction
{
public function run(array $data): PageReferenceList
{
$data['slug'] = $data['slug'] ?? Str::slug($data['title']);
$data['is_active'] = $data['is_active'] ?? true;
$data['content'] = $data['content'] ?? [];
return PageReferenceList::create($data);
}
}
@@ -0,0 +1,13 @@
<?php
namespace App\Containers\Dashboard\Actions\PageReferenceLists;
use App\Containers\Widget\Models\PageReferenceList;
class DeletePageReferenceListAction
{
public function run(PageReferenceList $list): bool
{
return $list->delete();
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Containers\Dashboard\Actions\PageReferenceLists;
use App\Containers\Widget\Models\PageReferenceList;
class ListPageReferenceListsAction
{
public function run(array $filters = []): array
{
$query = PageReferenceList::query();
if (!empty($filters['search'])) {
$query->where('title', 'like', '%' . $filters['search'] . '%');
}
if (isset($filters['is_active']) && $filters['is_active'] !== '') {
$query->where('is_active', (bool) $filters['is_active']);
}
$lists = $query->orderByDesc('created_at')->paginate(20)->withQueryString();
return [
'lists' => $lists,
'filters' => $filters,
];
}
}
@@ -0,0 +1,15 @@
<?php
namespace App\Containers\Dashboard\Actions\PageReferenceLists;
use App\Containers\Widget\Models\PageReferenceList;
class UpdatePageReferenceListAction
{
public function run(PageReferenceList $list, array $data): PageReferenceList
{
$list->update($data);
return $list;
}
}