samedi 22 juin 2019

Getting information from different Laravel relationships

I'm trying to get information from 3 tables in Laravel 5.8 but so far i have just come up with nothing.

The 3 tables look something similar to the following;

polls
    id - integer
    name - string
    status - tinyint

poll_options
    id - integer
    poll_id - integer
    image_id - integer
    status - tinyint

poll_images
    id - integer
    filename - varchar

A poll has several poll options, those poll options have 1 images each.

I would like to get poll options with the poll status of 1 and any images that have poll options with a status of 1

I need the get the filename, the poll option id and the poll id.

I'm so confused

Any help would be greatly appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire