Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stranyer's avatar

A more complete blog post

Hi everyone, Im new in Laravel, and I'm having some issues and a big headache with this.

So, I'm using this already made Blog CMS (Laravel 5.4) that i wanna update.

Anyway, I've 2 tables:

product_code:

ID   - product  - product_id  -     price
--------------------------------------
01  -    fridge  -          76        -      78.4
01  -    fridge  -          35        -      178.4
01  -    fridge  -          110        -      72
01  -    fridge  -          15        -       245
01  -    fridge  -          47        -      652

and table product_desc:

ID   -  product_id  -    description
-------------------------------------------
03  -        76           -  Basic fridge
03  -        35           -  Good fridge
03  -        110          -  Really basic
03  -        15            -  Modest Fridge
03  -        47           -  Amazing fridge

What I should fetch it's the 3 most expensives friges, and with its own description.

Something like

- **Amazing fridge**
- **Most fridge**
- **Good fridge**

Also, each post should load its owns products, so this is only valid for fridge post, each one has its own post_id.

0 likes
1 reply

Please or to participate in this conversation.