Skip to content

belongsTo 如何传递参数? #5866

@xiaoyuebao

Description

@xiaoyuebao
  • Laravel Version: 7.29
  • PHP Version:7.4.3
  • Laravel-admin: 1.8.9

Description:

belongsTo 如何传递参数?

$form->belongsTo('author_id', Products::class, '商品');
我想在Users::class里接收参数,请问如何实现呢

class Products extends Selectable
{
    public $model = Product::class;

    public function make()
    {   
        $this->model()->where('siteId',$siteId)->where('status',1)
                    ->orderby('sort','desc');            
        $this->column('id');
        $this->column('name','商品名称');
        $this->column('unit_price','单价');
        $this->column('cover','商品图片')->image();
        $this->column('created_at');

        $this->filter(function (Filter $filter) {
            $filter->disableIdFilter();
            $filter->like('name');
        });
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions