I have 3 tables in my laravel project 1 is users the 2nd is products and the 3rd is orders. I have canteen management website. I want to save the user order in the orders table. I make relation between these tables. I use the user_id and product_id as a forigen key in orders tables. But the issue is this when I can delete the product then its product_id deleted from orders tables. And if the order is pending or accepted or cancelled I don’t know which product is this , which user can order.
I want to expect that even If I can delete the product the name of the product show in orders table and it will not delete from order table . Even if the order is pending , accept or cancel. How I can make there relation to get this result.