mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
Fix failing test ensuring company id is an integer
This commit is contained in:
parent
979e4502ff
commit
7e1b47708e
|
@ -26,11 +26,18 @@ class StoreAssetRequest extends ImageUploadRequest
|
|||
|
||||
public function prepareForValidation(): void
|
||||
{
|
||||
// Guard against users passing in an array for company_id instead of an integer.
|
||||
// If the company_id is not an integer then we simply use what was
|
||||
// provided to be caught by model level validation later.
|
||||
$idForCurrentUser = is_int($this->company_id)
|
||||
? Company::getIdForCurrentUser($this->company_id)
|
||||
: $this->company_id;
|
||||
|
||||
$this->parseLastAuditDate();
|
||||
|
||||
$this->merge([
|
||||
'asset_tag' => $this->asset_tag ?? Asset::autoincrement_asset(),
|
||||
'company_id' => Company::getIdForCurrentUser($this->company_id),
|
||||
'company_id' => $idForCurrentUser,
|
||||
'assigned_to' => $assigned_to ?? null,
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue