'datetime', 'metadata' => 'array', ]; public function store(): BelongsTo { return $this->belongsTo(WooStore::class, 'woo_store_id'); } public function children(): HasMany { return $this->hasMany(self::class, 'parent_external_id', 'external_id') ->whereColumn('woo_store_id', 'woo_categories.woo_store_id'); } public function parentLabel(): ?string { if (! $this->parent_external_id) { return null; } return self::query() ->where('woo_store_id', $this->woo_store_id) ->where('external_id', $this->parent_external_id) ->value('name'); } }