From what I read clang-format is for c/c++/obj-c. Which tool like clang-format would you recommend to automatically format/reformat PHP/HTML code in a consistent way? And why? The use case would be to check code formatting in CI (continuous integration) when submitted through a ‘pull request’ for …
Laravel 8.x – How to use updateOrCreate with a where clause?
I am trying to use Laravel updateOrCreate to update a record if its within this month and last month based on if an ID exists. If the ID exists, and the result is in this current month or last, a new record is created instead of updated. Expected input: 1 (which exists from last month) Expected output: Record…
Catch inexistent static files in app.yaml
In app.yaml I have I would like to intercept / redirect non existent image files (gif | png | jpg). As it is, GAE returns an Error not found when requesting some inexistent file with the image extensions, I am looking if there’s some way -at app.yaml- level to intercept them. (I could remove the static …
Draw a horizontal and vertical line on mouse hover in chart js
I am stuck with a problem on chart js while creating line chart. I want to create a chart with the specified data and also need to have horizontal and vertical line while I hover on intersection point. I am able to create vertical line on hover but can not find any solution where I can draw both the line.
Nginx Php-fpm 7.3 Can’t read PHP files from a particular folder
We have a Magento 2 website. For some reason our Nginx/PHP-FPM is unable to read files from MAGEROOT/pub/ folder other than index.php. We are getting the following error in Nginx Log “Unable to open primary script: /home/goodprice/public_html/releases/current/pub/get.php (No such file or directory)̶…
PHP showing XML calendar data – merge day events
I have the following XML file, which I can’t edit. I am then outputting this using simplexml_load_file($url) into a PHP file: This gives me an output as follows: However, I would like to merge events by date, so the output would be as follows: How can I achieve this without editing the XML file? Thanks!…
Race condition with multiple updates PHP & MySQL
I have a table called cards, Each user can create/have multiple cards. One of the cards must be set as default. Sometimes when a user performs multiple requests to set another card as default at the same time, In the end, There are two or more default cards. Initial table: id user_id is_default 1 50 0 2 50 1 …
Show a date depending on day and time
I have this script that echo’s the upcoming Thursday, unless it’s Wednesday because then it shows the Thursday a week later. This works great. But what I would like is to add a cut-off time on Wednesday on 5PM (17:00 GMT+1 / CEST). So before 5PM it will still show the next Thursday (day after) but…
Missing months in Calendar
I am trying to set values of any missing months in my nested array for specific years. Data: As you can see in the above array, year 2019 and 2018 have missing months. How can I can add those missing months and set the values to zero? Please advice. Answer Use array_replace() to overlay one array with another…
Perfexcrm api return 419 status code, how solve it?
I use perfexcrm api in my web application. As its document I pass the URL in postman and also pass authentication token in headers of postman and company name in params in postman. I try to fetch all customers so I use api/customers as a URL and as a method I use POST for this. But as a output postman