Skip to content
Advertisement

How to print table data in Laravel 5.6?

in My Larvel 5.6 app I am working with mysql db. and in my application I have vehicle table with following columns, vehicles,

JavaScript

and I am going to group all models of the table and printing here as My controller,

JavaScript

my printing blade file is this,

JavaScript

it is printing well as

JavaScript

now I need print in-front of model name there brand name as

JavaScript

Then how can I do this now? I have separate Models for brand and model and still there are not relationship between Models. how can I do this, may I need relationship or may I could print brand name via vehicle table data?

Advertisement

Answer

The same way you select the model name column, you must also select the brand column, and then print the model with his brand name.

Try this:

In your controller:

JavaScript

and in your view:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement