contract obligation complete and accept api

This commit is contained in:
glovetleong
2021-07-27 13:36:51 +08:00
parent 7f209db917
commit 93b13a8f46
17 changed files with 550 additions and 20 deletions
+16 -4
View File
@@ -3,11 +3,8 @@
namespace App\Http\Rules\User;
use Auth;
use App\Models\ContractTemplate;
use App\Models\ContractTemplateObligation;
use App\Models\Contract;
use App\Models\ContractEntity;
use App\Models\Entity;
use App\Models\ContractObligation;
use App\Http\Helpers\Hasher;
@@ -57,6 +54,21 @@ class StatusCheck implements Rule
}
}
if ($this->type == 'contract_obligation') {
foreach ($value as $key => $row) {
if(!empty($row)) {
$id = Hasher::decode('contract_obligations', $row);
$data = ContractObligation::
where('id', $id)
->whereIn('status', $this->status)
->count();
if (!$data) {
return false;
}
}
}
}
return true;
}