'Created Packing List Remark', 'message' => 'You have successfully created a new Packing List Remark' ]; } /** @var CanCreateRemark */ private $canCreateRemark; /** @var CreatesPackingListRemark */ private $createsPackingListRemark; /** @var FetchesPackingList */ private $fetchesPackingList; /** * CreateRemarkLogic constructor. * @param CanCreateRemark $canCreateRemark * @param CreatesPackingListRemark $createsPackingListRemark */ public function __construct(CanCreateRemark $canCreateRemark, CreatesPackingListRemark $createsPackingListRemark, FetchesPackingList $fetchesPackingList) { $this->canCreateRemark = $canCreateRemark; $this->createsPackingListRemark = $createsPackingListRemark; $this->fetchesPackingList = $fetchesPackingList; } /** * @param Request $request * @return JsonResponse * @throws \App\Classes\Exceptions\AccessForbiddenException * @throws \App\Classes\Exceptions\MalformedRequestException * @throws \App\Classes\Exceptions\RequestValidationException */ public function logic(Request $request) : JsonResponse { $object = new RemarkObject( $request->input('content'), $request->route('id') ); $this->canCreateRemark->passes($object); $query = $this->createsPackingListRemark->execute($this->fetchesPackingList->execute(['id' => $request->route('id')]), $object); return $this->resourceResponse( new RemarkResource($query)); } }