belongsTo(ConfigOption::class, 'parent_id'); } /** * Get the options that belong to the parent. (children or options) */ public function children() { return $this->hasMany(ConfigOption::class, 'parent_id')->orderBy('sort'); } /** * Get the products that belong to the option. */ public function products() { return $this->belongsToMany(Product::class, 'config_option_products'); } /** * Get the service configs that belong to the option. */ public function serviceConfigs() { return $this->hasMany(ServiceConfig::class, 'config_option_id'); } }