2026-06-14 21:32:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Bo;
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
use App\Actions\Faqs\CreateFaq;
|
|
|
|
|
use App\Actions\Faqs\DeleteFaq;
|
|
|
|
|
use App\Actions\Faqs\DeleteFaqInput;
|
|
|
|
|
use App\Actions\Faqs\UpdateFaq;
|
2026-09-29 16:59:07 +02:00
|
|
|
use App\Contracts\Executor;
|
2026-06-14 21:32:07 +02:00
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Http\Requests\Bo\Faqs\StoreFaqRequest;
|
|
|
|
|
use App\Http\Requests\Bo\Faqs\UpdateFaqRequest;
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
use App\Lib\Helpers\RequestHelper;
|
2026-06-14 21:32:07 +02:00
|
|
|
use App\Models\Faq;
|
2026-09-29 14:53:02 +02:00
|
|
|
use App\Queries\Faqs\GetPaginatedFaqsQuery;
|
2026-09-29 16:59:07 +02:00
|
|
|
use App\Queries\Faqs\GetPaginatedFaqsQueryInput;
|
2026-06-14 21:32:07 +02:00
|
|
|
use App\Traits\Controllers\ChangesModelOrder;
|
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
|
use Illuminate\Http\RedirectResponse;
|
2026-09-29 16:59:07 +02:00
|
|
|
use Illuminate\Http\Request;
|
2026-06-14 21:32:07 +02:00
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
|
|
|
|
|
class FaqsController extends Controller
|
|
|
|
|
{
|
|
|
|
|
use ChangesModelOrder;
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
public function __construct(
|
2026-09-29 16:59:07 +02:00
|
|
|
private readonly Executor $executor,
|
2026-09-29 14:53:02 +02:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-29 16:59:07 +02:00
|
|
|
public function index(Request $request, GetPaginatedFaqsQuery $query): View
|
2026-06-14 21:32:07 +02:00
|
|
|
{
|
|
|
|
|
$this->authorize('viewAny', Faq::class);
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
$pagination = RequestHelper::pagination($request);
|
2026-06-14 21:32:07 +02:00
|
|
|
|
2026-09-29 16:59:07 +02:00
|
|
|
$faqs = $this->executor->execute(
|
|
|
|
|
$query,
|
|
|
|
|
new GetPaginatedFaqsQueryInput(
|
|
|
|
|
pagination: $pagination,
|
|
|
|
|
)
|
|
|
|
|
);
|
2026-06-14 21:32:07 +02:00
|
|
|
|
|
|
|
|
return view('bo.faqs.index', compact('faqs'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function create(): View
|
|
|
|
|
{
|
|
|
|
|
$this->authorize('create', Faq::class);
|
|
|
|
|
|
|
|
|
|
return view('bo.faqs.create');
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
public function store(StoreFaqRequest $request, CreateFaq $action): RedirectResponse
|
2026-06-14 21:32:07 +02:00
|
|
|
{
|
|
|
|
|
$this->authorize('create', Faq::class);
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
$faq = $this->executor->execute(
|
|
|
|
|
$action,
|
2026-10-01 11:25:05 +02:00
|
|
|
$request->toCreateFaqInput(),
|
2026-09-29 14:53:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return to_route('bo.faqs.edit', $faq)
|
|
|
|
|
->with('success', trans('crud.messages.has_been_created', [
|
|
|
|
|
'model' => Str::ucfirst(trans_choice('models.classes.faqs', 1)),
|
|
|
|
|
]));
|
2026-06-14 21:32:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function edit(Faq $faq): View
|
|
|
|
|
{
|
|
|
|
|
$this->authorize('update', $faq);
|
|
|
|
|
|
|
|
|
|
return view('bo.faqs.edit', compact('faq'));
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
public function update(UpdateFaqRequest $request, Faq $faq, UpdateFaq $action): RedirectResponse
|
2026-06-14 21:32:07 +02:00
|
|
|
{
|
|
|
|
|
$this->authorize('update', $faq);
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
$this->executor->execute(
|
|
|
|
|
$action,
|
2026-10-01 11:25:05 +02:00
|
|
|
$request->toUpdateFaqInput($faq),
|
2026-09-29 14:53:02 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return to_route('bo.faqs.edit', $faq)
|
|
|
|
|
->with('success', trans('crud.messages.has_been_updated', [
|
|
|
|
|
'model' => Str::ucfirst(trans_choice('models.classes.faqs', 1)),
|
|
|
|
|
]));
|
2026-06-14 21:32:07 +02:00
|
|
|
}
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
public function destroy(Faq $faq, DeleteFaq $action): RedirectResponse
|
2026-06-14 21:32:07 +02:00
|
|
|
{
|
|
|
|
|
$this->authorize('delete', $faq);
|
|
|
|
|
|
2026-09-29 14:53:02 +02:00
|
|
|
$this->executor->execute($action, new DeleteFaqInput(faq: $faq));
|
|
|
|
|
|
|
|
|
|
return to_route('bo.faqs.index')
|
|
|
|
|
->with('warning', trans('crud.messages.has_been_deleted', [
|
|
|
|
|
'model' => Str::ucfirst(trans_choice('models.classes.faqs', \INF)),
|
|
|
|
|
]));
|
2026-06-14 21:32:07 +02:00
|
|
|
}
|
|
|
|
|
}
|