I have two Eloquent models: Item’s columns are id, userId and name. When I want to update the user (PUT /users/<id>) I also want to update the items in the same request, meaning: Skip existing items Add new items Remove extra items Afterwards both DB and the relation should have up-to-date items. …
Tag: php
Filling boostrap cards with data from a mySQL database
I am trying to fill bootstrap cards with data from a database. I am very close. I have the mainphp file called project.php A file with a function called component to fill them, called component.php. And a connectDB.php file, that connect the DB and extracts the information from a table. I am aware this is alo…
Data from 2 tables is not displaying on the same page
I’m a newbie in PHP and mySQL, I’m currently working on a profile page where I will display the logged in user’s personal information from one table called users and also display the tours that they will book in the future from my website from this table: booking I’m fetching the data …
Verify all brackets are properly open/closed
I am trying to write a function that will return true if brackets are closed, for example {[()]} and false if brackets are open, for example ) ( . I have problem with writing logic behind it. I have some idea like modulo, but it won’t work and I dont know what direction to look in. Answer Starting by de…
xdebug installed successfully on linux but not working
I have installed and configured Xdebug on my Linux system, however, I can’t see “Xdebug” in my PHPinfo file despite enabling and when i put the phpinfo source code page in the xdebug wizard , shows me that: Xdebug installed: no Have you any ideas on how to solve this issue? Also, I added the…
PHP Parsing Getting the latest value from a string using a delimiter
I have a question which relates to PHP. Is there any way to just grab the last string using a delimiter? For example, to put you in perspective, I want to grab the lastest content from the / from every string. How could I using PHP cut the whole string and get only the latest value. The output would be
Laravel Filemanager Base url for Images is wrong
I need help configuring the site url being generated by Laravel File manager. I am developing my application locally on http://127.0.0.1:8000/. The name of the application is security. But whenever I upload images, its giving them a url of: http://security.test/storage/photos/1/logo-small.jpeg How can I chang…
Draw multiple Google pie charts in for loop
Here is what I’m trying to do. I’m trying to place multiple Google Pie Charts, I already put the code in, however, I’m getting the following error message: Uncaught TypeError: Cannot read property ‘arrayToDataTable’ of undefined and I’m getting another error message: Error:…
Exclude a WordsPress snippet’s functions to execute on a certain page
I’m trying to prevent a function redirecting to the previous page after logging in to execute on my WooCommerce /checkout page, as it causes an error. Here is the function (added to the functions.php file of my theme via the Code Snippet plugin): When logging in on the WooCommerce /checkout page, I get …
Laravel 8: How to style output at Models
I want to check if the status of users is Active or not. So in order to do this, I’ve added this piece of code to my Model User.php: public function isActive() { if(($this->status) == 1)…