如何用select显示这个组合?

时间:2018-04-14 23:20:24

标签: laravel combinations

模型结构如下所示

class Attribute extends Model
{
    public function products()
    {
        return $this->belongsToMany(Product::class);
    }

    public function attribute_options()
    {
        return $this->hasMany(AttributeOption::class);
    }
}

class AttributeOption extends Model
{
    public function attribute_option()
    {
        return $this->hasMany(CombinationDetail::class);
    }

    public function attribute(){
        return $this->belongsTo(Attribute::class);
    }
}

class Combination extends Model
{
    public function combination_details()
    {
        return $this->hasMany(CombinationDetail::class);
    }
}

class CombinationDetail extends Model
{
    protected $fillable = ['attribute_options_id'];

    public function attribute_options()
    {
        return $this->belongsTo(AttributeOption::class);
    }
}

这样的关系模型。

combination table

combination_details table

如何用selectbox或div用javascript

显示这个

0 个答案:

没有答案