Skip to content

Tag: mysql

Creating JSON Array out of PHP loop

in my current project I want to fill a bar chart with summed data for each day of a month. I get the required values from the database, but I can’t get the array created in the right format. So far, the individual values are just lined up and I can’t read them out in the JS. I have tried

Laravel find rows by nested relationship column

I have 2 tables reserves and chats, chats belongTo reserves and I want to get all chats where chat.reserve.user_id = Auth::id(). How can I do that in laravel. Answer I don`t know your models name (need more code in question), but try use where ‘reserves’ your relationship and have field user_id. M…

How to find a time between nested Json

I have created a table called ticket_manager with the following structure: Each time when the user based QR Code gets scanned it will add a new row (either when it’s a check-in it will add a new line to “checkIn with “check_in_$count” or a new line to checkOut with “check_out_$co…

Laravel Resource controller

How do I tell my API to display a particular result based on another column? e.g. localhost:8000/api/gadgets/{{id}} Normally it returns the particular information of the specific gadget with that ID and localhost:8000/api/gadgets/{{imei_code}} does not return any value or an error whereas imei_code is a colum…