mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-20 04:53:56 +00:00
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Addresses\ControllersLogic;
|
|
|
|
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
|
use App\Classes\Modules\Addresses\Services\DeletesDistrict;
|
|
use App\Classes\Modules\Addresses\Services\FetchesDistrict;
|
|
use ErrorException;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class DeleteDistrictLogic extends AbstractControllerLogic
|
|
{
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function notification():array {
|
|
return [
|
|
'title' => 'Deleted District',
|
|
'message' => 'You have successfully deleted a District'
|
|
];
|
|
}
|
|
|
|
/** @var DeletesDistrict */
|
|
private $deletesDistrict;
|
|
|
|
/** @var FetchesDistrict */
|
|
private $fetchesDistrict;
|
|
|
|
/**
|
|
* DeleteDistrictControllersLogic constructor.
|
|
* @param DeletesDistrict $deletesDistrict
|
|
* @param FetchesDistrict $fetchesDistrict
|
|
*/
|
|
public function __construct(DeletesDistrict $deletesDistrict, FetchesDistrict $fetchesDistrict)
|
|
{
|
|
$this->deletesDistrict = $deletesDistrict;
|
|
$this->fetchesDistrict = $fetchesDistrict;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return JsonResponse
|
|
* @throws ErrorException
|
|
*/
|
|
public function logic(Request $request) : JsonResponse
|
|
{
|
|
$district = $this->fetchesDistrict->execute(['id' => $request->route('id')]);
|
|
|
|
$this->deletesDistrict->execute($district);
|
|
|
|
return $this->response([]);
|
|
|
|
}
|
|
|
|
} |