mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
resolve a couple issues
This commit is contained in:
parent
8cc1397ace
commit
be282dd038
|
@ -673,7 +673,7 @@ class AssetsController extends Controller
|
||||||
} elseif (($request->filled('assigned_asset')) && ($target = Asset::find($request->get('assigned_asset')))) {
|
} elseif (($request->filled('assigned_asset')) && ($target = Asset::find($request->get('assigned_asset')))) {
|
||||||
$location = $target->location_id;
|
$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]);
|
->update(['location_id' => $target->location_id]);
|
||||||
} elseif (($request->filled('assigned_location')) && ($target = Location::find($request->get('assigned_location')))) {
|
} elseif (($request->filled('assigned_location')) && ($target = Location::find($request->get('assigned_location')))) {
|
||||||
$location = $target->id;
|
$location = $target->id;
|
||||||
|
|
|
@ -25,7 +25,7 @@ class UpdateAssetRequest extends ImageUploadRequest
|
||||||
*/
|
*/
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
$rules = array_merge([
|
||||||
'model_id' => ['integer', 'exists:models,id,deleted_at,NULL', 'not_array'],
|
'model_id' => ['integer', 'exists:models,id,deleted_at,NULL', 'not_array'],
|
||||||
'status_id' => ['integer', 'exists:status_labels,id'],
|
'status_id' => ['integer', 'exists:status_labels,id'],
|
||||||
'asset_tag' => ['min:1', 'max:255', 'not_array', Rule::unique('assets', 'asset_tag')->ignore($this->asset)->withoutTrashed()],
|
'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'],
|
'notes' => ['nullable', 'string', 'max:65535'],
|
||||||
'assigned_to' => ['nullable', 'integer'],
|
'assigned_to' => ['nullable', 'integer'],
|
||||||
'requestable' => ['nullable', 'boolean'],
|
'requestable' => ['nullable', 'boolean'],
|
||||||
parent::rules(),
|
],
|
||||||
];
|
parent::rules()
|
||||||
|
);
|
||||||
|
return $rules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue