mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-23 06:23:59 +00:00
8a28eb1790
This reverts merge request !5
63 lines
1.2 KiB
PHP
63 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Orders\Steps\Processors;
|
|
|
|
|
|
use App\Classes\Interfaces\Order\Steps\OrderRequirement;
|
|
use App\Models\OrderStep;
|
|
|
|
abstract class AbstractOrderRequirement implements OrderRequirement
|
|
{
|
|
/** @var string */
|
|
protected $orderId;
|
|
|
|
/** @var string */
|
|
protected $referenceId;
|
|
|
|
/**
|
|
* AbstractOrderRequirement constructor.
|
|
* @param string $orderId
|
|
* @param string $referenceId
|
|
*/
|
|
public function __construct(string $orderId, string $referenceId)
|
|
{
|
|
$this->orderId = $orderId;
|
|
$this->referenceId = $referenceId;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getOrderId(): string
|
|
{
|
|
return $this->orderId;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getReferenceId(): string
|
|
{
|
|
return $this->referenceId;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function completeStep(): bool {
|
|
|
|
$orderStep = OrderStep::where('order_id', $this->getOrderId())
|
|
->where('reference_id', $this->getReferenceId())->firstOrFail();
|
|
|
|
$orderStep->complete = 1;
|
|
|
|
if($orderStep->save()){
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
} |