contract template obligation api

This commit is contained in:
glovetleong
2021-06-28 21:20:32 +08:00
parent ebdf9d57cc
commit 64280f5754
12 changed files with 464 additions and 4 deletions
+16
View File
@@ -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;
}