keeps example values in the example preview, fixes indent

This commit is contained in:
Godfrey M 2024-02-21 09:31:01 -08:00
parent 69317fb403
commit bee016e0be

View file

@ -6,6 +6,7 @@ use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Category;
use App\Models\Company;
use App\Models\CustomField;
use App\Models\Labels\Label;
use App\Models\Location;
use App\Models\Manufacturer;
@ -65,11 +66,15 @@ class LabelsController extends Controller
$exampleAsset->model->category->id = 999999;
$exampleAsset->model->category->name = trans('admin/labels/table.example_category');
$customFieldColumns = CustomField::all()->pluck('db_column');
collect(explode(';', Setting::getSettings()->label2_fields))
->each(function ($item) use ($exampleAsset){
->each(function ($item) use ($customFieldColumns, $exampleAsset) {
$pair = explode('=', $item);
if ($customFieldColumns->contains($pair[1])) {
$exampleAsset->{$pair[1]} = "{{$pair[0]}}";
}
});
$settings = Setting::getSettings();