This code: Return output like this: What can I do to return an empty array of users? I tried to do like this: But got an error: Answer With the syntax you tried, the answer is “No”, as ->with() doesn’t perform any kind of join logic; so posts tables is not available there. If you want to …
How to enable php extensions when using the image php:7.2-apache with docker-compose?
I want to run a apache webserver with php extension inside container using docker compose as deployment. My compose file looks like this: how can I enable the following extensions. Answer First of all you can run php -m in php container to see installed and enabled modules. You can edit your docker-compose.ym…
merge two equal structural multi-arrays with different data
i can’t believe that i can’t find a solution to this seemingly simple problem, and i tried everything. i have two multi arrays: the first one: the second one has the exact same structure, but with new data: what i need mergin both multi-arrays is this result: but i can’t get this result with…
laravel breeze authentication failed in request file but it’s returns authenticated user in controller
I’m using Laravel breeze as the back end and nextjs in front end. First I login to site and every thing is correct. When trying to insert a new order, in OrderRequest file I Check if the user is authenticated or not : this method always return false but if I bypass the authentication process and always …
I need to check if time now is between two times
I need to check IF time is between two times with PHP I tried a lot of examples but they are not working for me, I guess I’m asking a stupid question but I’m not finding any answer. I need to check IF current time is between $datetime1 and $datetime2. IF is between { do something } ELSE { do
XERO API – JSON for post data was invalid,Cannot deserialize the current JSON object
I am using the Xero API, and following the docs but having a problem sending some specific data to this end point: https://developer.xero.com/documentation/api/accounting/invoices#post-invoices Here is my array in PHP: But the error I receive is this: If I remove the ‘Addresses’, it works fine. I …
How to send data in another page with a foreach loop and specific ID?
i have the follow code in PHP and HTML: And the JavaScript used in the button: In the beginning I am receiving the option of “Service 1” through a checkbox to proceed with the script I showed above, the problem arises when I want to select an ID from the 3 that are shown to generate a report in FP…
I want the minimum to be 0 but the substraction is still negative
I’m beggining in OOP with PHP, and i want to make 2 opponent fight, with the function fight. I want to have a $degat variable which is a result of a radom number between 1 to strength of attacker – (minus) dexterity of defender. So the result must be of minimum 0. I have this code and when I var_d…
How to get word after user input in textarea?
I have a text area to user to insert text, but if the user type {{name}}, {{nickname}} and {{email}}. It must show the message with that value. Let me demonstrate: For example: If user type: Hello, {{name}} has {{nickname}} and {{email}} the message must be like this: Hello, user A has nickname A and email@gm…
Best way to run a SQL query for different dates
I have a PHP application that records the sessions of various devices connected to a server. The database has a table session, with the columns device_id, start_date, end_date. To know the number of devices connected on a given date, I can use the request : where :date is passed as a parameter to the prepared…