Making CRUD on Backpack for Laravel, and got issue. I have Domain and domainPrices table Domain model:
public function domainPrice()
{
return $this->hasOne(DomainPrices::class, 'domain_id', 'id');
}
DomainPrices model:
public function domain()
{
return $this->belongsTo(Domain::class, 'id', 'domain_id');
}
Migration:
Schema::table('domain_prices', function(Blueprint $table) {
$table->foreign('domain_id')->references('id')->on('domains')
->onDelete('cascade')
->onUpdate('cascade');
});
For setupCreateOperation()
$this->crud->addField([
'name' => 'bin_price',
'type' => 'number',
'entity' => 'domainPrice',
'attribute' => 'bin_price',
'model' => 'DomainPrices',
'pivot' => false,
]);
setupUpdateOperation:
$this->setupCreateOperation();
And I'm able to store data with this, but when I use update route, there is empty field. But it is display the value, on list view with:
CRUD::column('domainPrice')->attribute('bin_price');
PHP VERSION: PHP 8.0.5
LARAVEL VERSION: v8.44.0
BACKPACK VERSION: 4.1.46