mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
44 lines
1.0 KiB
PHP
Executable File
44 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Services;
|
|
|
|
|
|
use App\Classes\Modules\Companies\Exceptions\CannotListCompanyOrderCategoryException;
|
|
use App\Models\Order;
|
|
use App\Http\Resources\Order as OrderResource;
|
|
|
|
class ListsCompanyCancelledOrders
|
|
{
|
|
/** @var Order */
|
|
private $repository;
|
|
|
|
/**
|
|
* ListsCompleteOrders constructor.
|
|
* @param Order $repository
|
|
*/
|
|
public function __construct(Order $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param int $id
|
|
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
|
* @throws CannotListCompanyOrderCategoryException
|
|
*/
|
|
public function execute(int $id){
|
|
|
|
try {
|
|
/** @var Order $orders */
|
|
$orders = $this->repository->where('company_id', $id)
|
|
->onlyTrashed()->get();
|
|
|
|
return OrderResource::collection($orders);
|
|
|
|
} catch (\Exception $exception){
|
|
throw new CannotListCompanyOrderCategoryException($exception->getMessage());
|
|
}
|
|
}
|
|
|
|
} |