resolve a couple issues

This commit is contained in:
spencerrlongg 2024-03-21 09:26:45 -05:00
parent 8cc1397ace
commit be282dd038
2 changed files with 6 additions and 4 deletions

View file

@ -673,7 +673,7 @@ class AssetsController extends Controller
} elseif (($request->filled('assigned_asset')) && ($target = Asset::find($request->get('assigned_asset')))) {
$location = $target->location_id;
Asset::where('assigned_type', \App\Models\Asset::class)->where('assigned_to', $id)
Asset::where('assigned_type', \App\Models\Asset::class)->where('assigned_to', $asset->id)
->update(['location_id' => $target->location_id]);
} elseif (($request->filled('assigned_location')) && ($target = Location::find($request->get('assigned_location')))) {
$location = $target->id;

View file

@ -25,7 +25,7 @@ class UpdateAssetRequest extends ImageUploadRequest
*/
public function rules()
{
return [
$rules = array_merge([
'model_id' => ['integer', 'exists:models,id,deleted_at,NULL', 'not_array'],
'status_id' => ['integer', 'exists:status_labels,id'],
'asset_tag' => ['min:1', 'max:255', 'not_array', Rule::unique('assets', 'asset_tag')->ignore($this->asset)->withoutTrashed()],
@ -47,7 +47,9 @@ class UpdateAssetRequest extends ImageUploadRequest
'notes' => ['nullable', 'string', 'max:65535'],
'assigned_to' => ['nullable', 'integer'],
'requestable' => ['nullable', 'boolean'],
parent::rules(),
];
],
parent::rules()
);
return $rules;
}
}