Skip to content
Advertisement

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. Maybe needed full path to field like ‘reserves’.’user_id’ Also

PHP/MariaDB On Duplicate Key Update with nested JSON array

So this one is fun. I’m integrating a 3rd party POS into my custom inventory management software I made for this client some time ago. My system is a basic PHP/HTML/JS background. I have webhooks from the 3rd party system sending my site JSON information about product info and stock details. The issue I have is that when we update

How can I make a collection in Laravel, where same keys will combine?

Using Laravel 8, I want to count travelers who visit my tourist information center. Traveler comes to our info center, asks anything, our employee gives necessary information and then we ask for travelers nationality to count for the statistic reasons. For example, if the traveler is from Germany, an employee adds him into our stats table submitting a form. If

How can show unlimited parent-child & sub-child tree data in laravel

I have data like parent-child with unlimited levels of sub-child & sub-child data in the database which you can see below like a binary tree with nodes that have multiple children and these children can have unlimited sub-child. Please give me a solution or suggestion how can show that. Thanks. This is my database JSON data which I’m getting from

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_$count” -> So for example “check_in_0 is a pair with “check_out_0″so..

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 column that I needed to pass as a GET request… I’m using the normal resource controller

Advertisement