CRUD icon indicating copy to clipboard operation
CRUD copied to clipboard

[Bug] Form Operation - cannot add raw fields of a morph as hidden fields

Open realtebo opened this issue 10 months ago • 3 comments

Bug report

What I did

Created a "form operation"

 php artisan backpack:crud-form-operation Storn

the model as a coinable MorphTo relation. so the table has coinable_id and coinable_type

this because the operation is loading into crud currentEntry a record I want to manipulate,

I want to add as hidden fileds these 2 fields

    $this->crud->addField([
        'type' => 'hidden',
        'name' => 'coinable_id',
        'value' => $this->crud->getCurrentEntry()->coinable->id,
    ]);

    $this->crud->addField([
        'type' => 'hidden',
        'name' => 'coinable_type',
        'value' => $this->crud->getCurrentEntry()->coinable_type,
    ]);

What I expected to happen

I expeteced 2 hidden fields; coinable_id and coinable_type

What happened

image

What I've already tried to fix it

nothing for now

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?

yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
PHP 8.2.8 (cli) (built: Jul  4 2023 15:53:15) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies

### LARAVEL VERSION:
10.20.0.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.1.1
backpack/crud: 6.1.15
backpack/generators: v4.0.2
backpack/pro: 2.0.11
backpack/theme-tabler: 1.0.12

realtebo avatar Aug 25 '23 09:08 realtebo