This commit refactors the import statements in various controllers and jobs to improve code organization and readability. Unused imports were removed, and necessary imports were added to ensure proper functionality.
38 lines
1 KiB
PHP
38 lines
1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Controllers\Fo\Ajax;
|
|
|
|
use App\Contracts\Executor;
|
|
use App\Cqs\Queries\Timeslots\GetAvailableTimeslotsQuery;
|
|
use App\Cqs\Queries\Timeslots\GetAvailableTimeslotsQueryInput;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Resources\Fo\Ajax\TimeSlotResource;
|
|
use App\Models\Shop;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
|
|
|
class PickupController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly Executor $executor,
|
|
) {
|
|
}
|
|
|
|
public function getAvailableTimeslots(Shop $shop, GetAvailableTimeslotsQuery $action): AnonymousResourceCollection | JsonResponse
|
|
{
|
|
$this->authorize('viewPickupTimeslots', $shop);
|
|
|
|
$result = $this->executor->execute(
|
|
$action,
|
|
new GetAvailableTimeslotsQueryInput(
|
|
$shop->getId()
|
|
)
|
|
);
|
|
|
|
return TimeSlotResource::collection(
|
|
$result->timeslotList
|
|
);
|
|
}
|
|
}
|