@@ -13,17 +13,26 @@ trait MayContainCustomFields
|
||||
|
||||
|
||||
// For auditing and some other non-standard things where $this is only the form submission and may not have the asset info
|
||||
if ((request()->route('asset') && (request()->route('asset')->model_id))) {
|
||||
$asset_model = AssetModel::find(request()->route('asset')->model_id);
|
||||
} else {
|
||||
// find the model
|
||||
if ($this->method() == 'POST') {
|
||||
$asset_model = AssetModel::find($this->model_id);
|
||||
}
|
||||
if ($this->method() == 'PATCH' || $this->method() == 'PUT') {
|
||||
$asset_model = $this->asset->model;
|
||||
}
|
||||
}
|
||||
// In case the model is being changed
|
||||
if (request()->input('model_id')->model_id!='') {
|
||||
|
||||
$asset_model = AssetModel::find(request()->route('asset')->model_id);
|
||||
|
||||
// or if we have it available to route-model-binding
|
||||
} elseif ((request()->route('asset') && (request()->route('asset')->model_id))) {
|
||||
|
||||
$asset_model = AssetModel::find(request()->route('asset')->model_id);
|
||||
|
||||
} else {
|
||||
|
||||
if ($this->method() == 'POST') {
|
||||
$asset_model = AssetModel::find($this->model_id);
|
||||
}
|
||||
|
||||
if ($this->method() == 'PATCH' || $this->method() == 'PUT') {
|
||||
$asset_model = $this->asset->model;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// collect the custom fields in the request
|
||||
|
||||
Reference in New Issue
Block a user