Love the idea of the package but I'm running into some issues.
I have two classes, Product and Subscription and product type points to itself (I saw it in the test models with the Car,Truck and Vehicle).
class Product extends Model {
use HasFactory, HasChildren;
public static function childTypes():array
{
return [
'product' => self::class,
'subscription' => Subscription::class
];
}
}
class Subscription extends Product
{
use HasParent;
}
When I use Product::all() the result is filled with products and subscriptions and when I use Subscription::all() the result is filled only with subscription. I saw that HasParent registers global scope which filters by the $this->getInheritanceColumn() and I can always implement such logic in the Product model but I was wondering Is there any method or scope that I'm missing?
Love the idea of the package but I'm running into some issues. I have two classes,
Product
andSubscription
andproduct
type points to itself (I saw it in the test models with theCar,
Truck
andVehicle
).When I use
Product::all()
the result is filled with products and subscriptions and when I useSubscription::all()
the result is filled only with subscription. I saw thatHasParent
registers global scope which filters by the$this->getInheritanceColumn()
and I can always implement such logic in theProduct
model but I was wondering Is there any method or scope that I'm missing?