Gustavo Silva
Gustavo Silva

Reputation: 17

How to access Model Values when using backpack fields on custom (non-CRUD) pages?

Based on the following link, we can use Laravel backpack fields on non-crud pages:

How to access backpack fields on custom (non-CRUD) page?

But what would be the correct way to pass model values to those?

Thanks in advance for any insight.

Upvotes: 0

Views: 459

Answers (1)

Gustavo Silva
Gustavo Silva

Reputation: 17

Welp. Had a look at the source and figured it out. :)

Might be handy for someone looking for it.

Attribute 'Value'.

$model=User::find(1);

$crud->addField([
    'name' => 'name',
    'label' => 'Name',
    'value' => $model->name
]);

Upvotes: 1

Related Questions