Replies: 1 comment
-
So, what is the question? you can't get media? wich package version do you have? can you do a debug on your sqls? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a app that provides api for a frontend application in Nuxt.js
I have following relations:
'users' table is related to 'posts' and 'posts' is related to 'media'
Users may not upload images at the time post is created and may upload/attach images after some time (like days, weeks)
'posts' table has 'images_present' column that is set to false by default and is set to true when images are uploaded.
I want to get a list of users with posts that has images. I should be able to send the image/thumbnail url/path to the frontend.
My current query is:
User::with(['posts' => function($q){ $q->select('id','user_id','images_present'); $q->where(['images_present' => true]); }, 'posts.media'])->first()
Edit:
forgot to mention that for each post images are uploaded/saved to two different collections.
Beta Was this translation helpful? Give feedback.
All reactions