Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

belongsTo 如何传递参数? #5866

Open
xiaoyuebao opened this issue Oct 21, 2024 · 0 comments
Open

belongsTo 如何传递参数? #5866

xiaoyuebao opened this issue Oct 21, 2024 · 0 comments

Comments

@xiaoyuebao
Copy link

xiaoyuebao commented Oct 21, 2024

  • 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');
        });
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant