jeudi 31 octobre 2019

Use variable in a query to access more data in Laravel

I am trying to convert a simple core php code to laravel but I am not able to successfully convert it. Here let me explain you fully. I have two tables in my database,

(1) mainCatData (2) subCatData

Below are the images if table strucutre

mainCatData Table

subCatData Table

The code I am using in core php is below,

The core php code

Above code is working fine and shows me the data in correct format. (One main category heading and all the sub catgeories heading related to the main catgeory and so on.) The main logic I am not able to transfer in Laravel is how to save the "mainCatData_id" column in a variable and use it to get data from "subCatData" values. Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire