mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-22 13:54:07 +00:00
contract entity api
This commit is contained in:
@@ -5,6 +5,9 @@ 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\Http\Helpers\Hasher;
|
||||
|
||||
@@ -65,6 +68,48 @@ class ExistCheck implements Rule
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->type == 'contract') {
|
||||
foreach ($value as $key => $row) {
|
||||
if(!empty($row)) {
|
||||
$id = Hasher::decode('contracts', $row);
|
||||
$data = Contract::
|
||||
where('id', $id)
|
||||
->count();
|
||||
if (!$data) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->type == 'contract_entity') {
|
||||
foreach ($value as $key => $row) {
|
||||
if(!empty($row)) {
|
||||
$id = Hasher::decode('contract_entities', $row);
|
||||
$data = ContractEntity::
|
||||
where('id', $id)
|
||||
->count();
|
||||
if (!$data) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->type == 'entity') {
|
||||
foreach ($value as $key => $row) {
|
||||
if(!empty($row)) {
|
||||
$id = Hasher::decode('entities', $row);
|
||||
$data = Entity::
|
||||
where('id', $id)
|
||||
->count();
|
||||
if (!$data) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user