mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 11:43:47 -08:00
Merge pull request #14281 from Godmartinz/preview-label-fields
Added better label previews with the new label engine
This commit is contained in:
commit
9fd6aea325
|
@ -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,6 +66,18 @@ 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))
|
||||
->filter()
|
||||
->each(function ($item) use ($customFieldColumns, $exampleAsset) {
|
||||
$pair = explode('=', $item);
|
||||
|
||||
if ($customFieldColumns->contains($pair[1])) {
|
||||
$exampleAsset->{$pair[1]} = "{{$pair[0]}}";
|
||||
}
|
||||
});
|
||||
|
||||
$settings = Setting::getSettings();
|
||||
if (request()->has('settings')) {
|
||||
$overrides = request()->get('settings');
|
||||
|
|
Loading…
Reference in a new issue