mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Changed to use instanceof
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
f13c1a53ef
commit
f9139e0f10
|
@ -574,10 +574,11 @@ class AssetsController extends Controller
|
||||||
$asset = $request->handleImages($asset);
|
$asset = $request->handleImages($asset);
|
||||||
|
|
||||||
// Update custom fields in the database.
|
// Update custom fields in the database.
|
||||||
// Sometimes people send arrays to this. They shouldn't, but they do, so we use "first()" to get the first match
|
$model = AssetModel::find($request->input('model_id'));
|
||||||
$model = AssetModel::where('id', '=', $request->get('model_id'))->first();
|
|
||||||
|
|
||||||
if (($model) && ($model->fieldset)) {
|
// Check that it's an object and not a collection
|
||||||
|
// (Sometimes people send arrays here and they shouldn't
|
||||||
|
if (($model) && ($model instanceof AssetModel) && ($model->fieldset)) {
|
||||||
foreach ($model->fieldset->fields as $field) {
|
foreach ($model->fieldset->fields as $field) {
|
||||||
|
|
||||||
// Set the field value based on what was sent in the request
|
// Set the field value based on what was sent in the request
|
||||||
|
|
Loading…
Reference in a new issue