mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-27 08:24:39 +00:00
packing schedule, transport, complete
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transports\Services\UpdatesDropDateTransport;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class UpdateDropDatePackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Drop Date Packing List',
|
||||
'message' => 'You have successfully updated the Drop Date Packing List'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var UpdatesDropDateTransport */
|
||||
private $updatesDropDateTransport;
|
||||
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/**
|
||||
* UpdateDispatchDatePackingListLogic constructor.
|
||||
* @param CanUpdateContainer $canUpdateContainer
|
||||
* @param UpdatesDropDateTransport $updatesDropDateTransport
|
||||
* @param FetchesPackingList $fetchesPackingList
|
||||
*/
|
||||
public function __construct(UpdatesDropDateTransport $updatesDropDateTransport, FetchesPackingList $fetchesPackingList)
|
||||
{
|
||||
$this->updatesDropDateTransport = $updatesDropDateTransport;
|
||||
$this->fetchesPackingList = $fetchesPackingList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
|
||||
$transport = $packing_list->transports()->first();
|
||||
$query = $this->updatesDropDateTransport->execute($transport, Carbon::parse($request->input('drop_date')));
|
||||
return $this->resourceResponse(new PackingListResource($packing_list));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user