mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-22 22:14:26 +00:00
WIP - Order steps & remaining APIs
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Remarks\ControllersLogic;
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Remarks\Services\UpdatesRemark;
|
||||
use App\Classes\Modules\Remarks\Services\FetchesRemark;
|
||||
use App\Classes\Modules\Remarks\Services\FetchesDistrict;
|
||||
use App\Classes\Modules\Remarks\Standards\Rules\CanUpdateRemark;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Http\Resources\RemarkResource;
|
||||
use App\Classes\Modules\PackingLists\Services\UpdatesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesDistrict;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\CanUpdatePackingList;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateRemarkLogic extends AbstractControllerLogic
|
||||
class UpdatePackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -22,35 +22,35 @@ class UpdateRemarkLogic extends AbstractControllerLogic
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Remark',
|
||||
'message' => 'You have successfully updated the Remark'
|
||||
'title' => 'Updated PackingList',
|
||||
'message' => 'You have successfully updated the PackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateRemark */
|
||||
private $canUpdateRemark;
|
||||
/** @var CanUpdatePackingList */
|
||||
private $canUpdatePackingList;
|
||||
|
||||
/** @var UpdatesRemark */
|
||||
private $updatesRemark;
|
||||
/** @var UpdatesPackingList */
|
||||
private $updatesPackingList;
|
||||
|
||||
/** @var FetchesRemark */
|
||||
private $fetchesRemark;
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/** @var FetchesDistrict */
|
||||
private $fetchesDistrict;
|
||||
|
||||
/**
|
||||
* UpdateRemarkLogic constructor.
|
||||
* @param CanUpdateRemark $canUpdateRemark
|
||||
* @param UpdatesRemark $updatesRemark
|
||||
* @param FetchesRemark $fetchesRemark
|
||||
* UpdatePackingListLogic constructor.
|
||||
* @param CanUpdatePackingList $canUpdatePackingList
|
||||
* @param UpdatesPackingList $updatesPackingList
|
||||
* @param FetchesPackingList $fetchesPackingList
|
||||
* @param FetchesDistrict $fetchesDistrict
|
||||
*/
|
||||
public function __construct(CanUpdateRemark $canUpdateRemark, UpdatesRemark $updatesRemark, FetchesRemark $fetchesRemark, FetchesDistrict $fetchesDistrict)
|
||||
public function __construct(CanUpdatePackingList $canUpdatePackingList, UpdatesPackingList $updatesPackingList, FetchesPackingList $fetchesPackingList, FetchesDistrict $fetchesDistrict)
|
||||
{
|
||||
$this->canUpdateRemark = $canUpdateRemark;
|
||||
$this->updatesRemark = $updatesRemark;
|
||||
$this->fetchesRemark = $fetchesRemark;
|
||||
$this->canUpdatePackingList = $canUpdatePackingList;
|
||||
$this->updatesPackingList = $updatesPackingList;
|
||||
$this->fetchesPackingList = $fetchesPackingList;
|
||||
$this->fetchesDistrict = $fetchesDistrict;
|
||||
}
|
||||
|
||||
@@ -65,16 +65,16 @@ class UpdateRemarkLogic extends AbstractControllerLogic
|
||||
try {
|
||||
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
$object = new RemarkObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'));
|
||||
//$object = new RemarkObject($request->input('company_id'), $request->input('street_one'), $request->input('street_two'), $request->input('city'), $request->input('state'), $request->input('post_code'), $request->input('country'), $request->input('default'), $request->input('billing'));
|
||||
$object = new PackingListObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'));
|
||||
//$object = new PackingListObject($request->input('company_id'), $request->input('street_one'), $request->input('street_two'), $request->input('city'), $request->input('state'), $request->input('post_code'), $request->input('country'), $request->input('default'), $request->input('billing'));
|
||||
|
||||
$this->canUpdateRemark->passes($object);
|
||||
$this->canUpdatePackingList->passes($object);
|
||||
|
||||
$query = $this->fetchesRemark->execute(['id' => $request->route('id')]);
|
||||
$query = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
$query = $this->updatesRemark->execute($query, $object);
|
||||
$query = $this->updatesPackingList->execute($query, $object);
|
||||
|
||||
return $this->resourceResponse(new RemarkResource($query));
|
||||
return $this->resourceResponse(new PackingListResource($query));
|
||||
|
||||
|
||||
} catch (\Exception $exception){
|
||||
|
||||
Reference in New Issue
Block a user