mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 12:24:01 +00:00
contract template obligation api
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Rules\User;
|
||||
|
||||
use Auth;
|
||||
use App\Models\ContractTemplate;
|
||||
use App\Models\ContractTemplateObligation;
|
||||
|
||||
use App\Http\Helpers\Hasher;
|
||||
|
||||
@@ -51,6 +52,21 @@ class UnderCheck implements Rule
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->type == 'contract_template_obligation') {
|
||||
foreach ($value as $key => $row) {
|
||||
if(!empty($row)) {
|
||||
$id = Hasher::decode('contract_template_obligations', $row);
|
||||
$data = ContractTemplateObligation::
|
||||
where('id', $id)
|
||||
->where('user_id', Auth::guard('user-api')->user()->id)
|
||||
->count();
|
||||
if (!$data) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user