File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,18 @@ public function authorize(): bool
2626
2727 public function prepareForValidation (): void
2828 {
29+ // Guard against users passing in an array for company_id instead of an integer.
30+ // If the company_id is not an integer then we simply use what was
31+ // provided to be caught by model level validation later.
32+ $ idForCurrentUser = is_int ($ this ->company_id )
33+ ? Company::getIdForCurrentUser ($ this ->company_id )
34+ : $ this ->company_id ;
35+
2936 $ this ->parseLastAuditDate ();
3037
3138 $ this ->merge ([
3239 'asset_tag ' => $ this ->asset_tag ?? Asset::autoincrement_asset (),
33- 'company_id ' => Company:: getIdForCurrentUser ( $ this -> company_id ) ,
40+ 'company_id ' => $ idForCurrentUser ,
3441 'assigned_to ' => $ assigned_to ?? null ,
3542 ]);
3643 }
You can’t perform that action at this time.
0 commit comments