Hello @maximos
If I understand your models correctly the additional fields that you want are requirements for the discount.
I should advice to create a model DiscountRequirement that contains the needed key/values. (And if you don't like that you can use a json column but I personal don't prefer that because you are missing the normalized value from your database)
If you want more validation you can also create a Discount type with required fields but I don't know if that is needed/wanted in your case.
Please tell me if it is clear or that you have more questions :)
And maybe you can write out a diagram to get a visible picture and documentation in one action. (like with mermaid, that is text that you can transform to an image) https://mermaid.js.org/syntax/entityRelationshipDiagram.html
maximos liked this reply
Thanks) I created custom pivot model and store additional fields for birthday discount in field birthday:
class DiscountPlace extends Pivot
{
protected $casts = [
'birthday' => 'object'
];
}
tvbeek liked this reply
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community