Files

57 lines
1.6 KiB
PHP

<?php
namespace App\Classes\Modules\Bookings\ControllersLogic;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Bookings\Services\FetchesBooking;
use App\Classes\Modules\Bookings\Services\UpdatesBookingTrusted;
use App\Classes\ValueObjects\Constants\BookingTrust;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class TrustedSellerLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Trust the seller',
'message' => 'You have successfully approved the seller'
];
}
/** @var FetchesBooking */
private $fetchesBooking;
/** @var UpdatesBookingTrusted */
private $updatesBookingTrusted;
/**
* TrustedSellerLogic constructor.
* @param FetchesBooking $fetchesBooking
* @param UpdatesBookingTrusted $updatesBookingTrusted
*/
public function __construct(FetchesBooking $fetchesBooking, UpdatesBookingTrusted $updatesBookingTrusted)
{
$this->fetchesBooking = $fetchesBooking;
$this->updatesBookingTrusted = $updatesBookingTrusted;
}
/**
* @param Request $request
* @return JsonResponse
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function logic(Request $request) : JsonResponse
{
$booking = $this->fetchesBooking->execute(['id' => $request->route('id')]);
$this->updatesBookingTrusted->execute($booking, BookingTrust::TRUSTED);
return $this->response([]);
}
}