I would like to keep multidimentional array in session : Session::push(‘preBookDataToCompare’, $preBookDataToCompare); Array is generated and added to session just after user open page. He may open new TAB with diff item_id or dates … So how to check that array in session for : if set : user…
Tag: php
Improve eager loading with multiple relationships of the same type
I have the following model: When I do Message::with([‘sender’, ‘receiver’])->all(), eager loading executes the following queries: That’s almost the least redundant way possbile. But it still loads user 3 and user five two times. Is there a way to further improve this using elo…
Regex to select a certain word followed by a integer or decimal?
I need a regular expression to detect the phrase Figure 1.5: in a given string. Also, I intend on using this expression in a PHP preg_replace() function. Here are some more examples: …are given. Figure 2.1: shows that… …are given. Figure 3: shows that… …are given. Figure 1.16: sh…
Import values from temporary table to another table?
I’m joining 3 tables: Currently, I’m fetching the data, build a new array and insert it into my final table. However, I wonder if it’s possible to do this in one go, so basically directly from the temporary table? Answer Yes. Use INSERT . . . SELECT: Note that I introduced table aliases. The…
Cant access Json Array values created by json_decode
My json_decode() is returning an array but i just cant seem to access it. Here’s as much of information i think would be useful. I’m pulling a json value from a server using curl commands. The response (output) from the server : Converting the json formatted string to json array: output: Clearly $…
Update multiple in one query in mysql
I have a problem on how can I update multiple in mysql in just one query the flow here is just like these. This will work and runs correctly What I’ve tried But the problem, it update all of my records into null even if the value of each column is not equal to 0000-00-00 since I’ve been using OR
I have a little problem to confuse, when I click the button to add new table, it’s cannot add under the
I have a little problem to confuse, when I click the button to add new table, it’s cannot add under the <tr> Where has a problem? this is my code js.code PHP code When I click the add_ag button, it cannot add table under the Answer like this html
PHPUnit assertDatabaseHas with Laravel and Inertia
I have a Laravel 8 setup that utilises Intertia.js. I’m trying to test my post routes to store new resources and want to assert that the database has the new record stored, using the assertDatabaseHas() method. Controller.php CreateSlotTest.php When I debug the session I can see the slot that I added to…
Laravel passing data from Controller to view without refreshing
I’m pretty new to Laravel and I’m trying to pass data from my controller to the view, which I managed to do as follows: Controller: main.blade.php: This works fine but now my question is what can I do if I want to change the value of value1 with another method of the controller without refreshing …
check expire time for each verification code
In the code below i check If there is a record for the user Check if exprire_at is smaller than it is now, it will expire and create a new code, otherwise show the user a message. But in both cases a new code is created What is the problem Answer change to and to