dijkr / Copia

Laravel-project with CMS
0 stars 0 forks source link

Promotion table handling #13

Open dijkr opened 1 year ago

dijkr commented 1 year ago

Solution 1 Every promotion would have unique information, therefor has its own table. A solution would be to delete the table, once the promotion has ended.

Solution 2 One table to point to the product, combined with all the promotion details.

dijkr commented 1 year ago

This might work: (table) PromotionProducts id product_id promotion_id DiscountPrice

(table) Promotions Promotion ValidUntil

dijkr commented 1 year ago

Model:

    public function product()
    {
        return $this->belongsTo(Product::class);
    }

Could promotion has many products be a good option? With the current table, every row is directly assigned to the products. And the promotion-details are added for every row. So actually, its just adding to the product, not really undoubling promotion details. Its still better then directly adding these details to the product, since now only promotion-products are affected. Probably still makes it a valid solition. But I guess just having to put the promotion-details once at a table, its a much better solution.