Activate contract

This commit is contained in:
Fairuz
2021-08-03 02:01:20 +08:00
parent ec1e338870
commit 3f70ead69a
7 changed files with 49 additions and 7 deletions
@@ -25,7 +25,9 @@ class OrderStepsObject implements DataTransferObject
private $completed_date;
public function __construct(int $order_id, int $appointee_id, string $reference, bool $primary, float $sequence, int $status, int $contract_status, ?string $completed_date, int $id=0)
private $hash_id;
public function __construct(int $order_id, int $appointee_id, string $reference, bool $primary, float $sequence, int $status, int $contract_status, ?string $completed_date, int $id=0, ?string $hash_id)
{
$this->order_id = $order_id;
$this->appointee_id = $appointee_id;
@@ -38,6 +40,7 @@ class OrderStepsObject implements DataTransferObject
$this->completed_date = $completed_date;
$this->id = $id;
$this->hash_id = $hash_id;
}
public function getOrderId(): int
@@ -49,10 +52,12 @@ class OrderStepsObject implements DataTransferObject
{
return $this->appointee_id;
}
public function getReference(): string
{
return $this->reference;
}
public function getPrimary(): bool
{
return $this->primary;
@@ -83,4 +88,8 @@ class OrderStepsObject implements DataTransferObject
return $this->id;
}
}
public function getHashId(): ?string
{
return $this->hash_id;
}
}
@@ -37,7 +37,7 @@ class CreateOrderStepsProcessor
public function execute(Model $order, string $currentStep, $appointee_id){
$order_steps_object = new OrderStepsObject($order->id, $appointee_id, $currentStep, true, 0, OrderStatus::PROCESSING, 0, null);
$order_steps_object = new OrderStepsObject($order->id, $appointee_id, $currentStep, true, 0, OrderStatus::PROCESSING, 0, null, 0, null);
$this->canCreateOrderStep->passes($order_steps_object);
@@ -54,7 +54,9 @@ class GenerateOrderStepsProcessor
$step->sequence??0,
0,
0,
null
null,
0,
$step->hash_id
);
}
@@ -31,7 +31,7 @@ class UpdateOrderStepsProcessor
public function execute(string $currentStep){
$orderStepsObject = new OrderStepsObject(0,0,$currentStep, 0, 0, 1, 1, null);
$orderStepsObject = new OrderStepsObject(0,0,$currentStep, 0, 0, 1, 1, null, 0, null);
$this->canUpdateOrderStep->passes($orderStepsObject);
@@ -21,7 +21,8 @@ class CreatesManyOrderSteps extends AbstractUpdateRecord
'primary' => $step->getPrimary(),
'sequence' => $step->getSequence(),
'status' => 0,
'contract_status' => 0
'contract_status' => 0,
'unity_hash_id' => $step->getHashId(),
];
}
$order->orderSteps()->createMany($orderStepsModel);
+1 -1
View File
@@ -12,5 +12,5 @@ class OrderStep extends AbstractModel
protected $dates = ['deleted_at'];
protected $fillable = ['order_id','appointee_id','reference','primary','sequence','status','contract_status','complete_date'];
protected $fillable = ['order_id','appointee_id','reference','primary','sequence','status','contract_status','complete_date','unity_hash_id'];
}
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class ModifyOrderSteps extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('order_steps', function (Blueprint $table) {
$table->string('unity_hash_id',200)->nullable(true)->after('contract_status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}