Can someone please tell me what I’m doing wrong. I am trying to select everything from users and then I want to use the [‘password’] and den [‘verified’] strings from the database, where it says ‘//…
Return data from 2 pivot tables
I have products, categories, sizes tables and also have 2 pivot tables named category_product and product_size in my database. I am trying to get products belong to a specific category and I need to …
Return occurence of letters in order in the string
I made this code to return the number of occurrences of letters in a string. this function returns ‘6a3b5y’ but I want it to respect the order and display ‘4a3b2a5y’ how to change it to display ‘4a3b2a5y’ ? Answer Use a variable to hold the previous character. Compare the c…
Is it possible to implement actingAs() function in Laravel if I created another User model?
I’m trying to implement some Laravel tests. I would like to test some authenticated routes, but I’m not using the default user model. I created a new one. Is there a way for me to use the ->…
What php function to use when escaping strings inside arrays for postgresql queries
I have a query that uses an array as follows: SELECT * FROM devices WHERE code = ANY (‘{“value1″,”value2″,”…”}’); If value1 is instead val”ue1 the query will fail. …
PHP PSR Whitespaces before and after concatenate operator question (dot)
I am looking for information about best practices when programming at PHP. I could not find any information about the space before and after the concatenate operator “dot” (.). $var = “…
Why is my session unset/ destroy not working?
On my page I have a session being created which can be accessed and called fine usually. However, I am adding a logout button which links to logout.php which only contains the lines session_unset(); …
How can I run php artisan serve using .env.production?
I have a Laravel Web Application, and it works just fine locally, using a local .env file that references the local database. I have the same Laravel Web Application deployed in production, where I find a .env, which is different from the one that I use locally. Both the scenarios work perfectly, but when I w…
php.ini updates not reflected in phpinfo() output
I am trying to update memory_limit in php.ini, but I don’t see the value updated in phpinfo(). Here is the ini file path info from phpinfo(): Configuration File (php.ini) Path: /etc Loaded …
Migrate to PHP 8.0: Unbinding $this when $this is used
Step by step, I am migrating my project(s) from PHP 7.1 to PHP 8.0. In the official PHP manual, in the subchapter “Deprecated Features” of the chapter “Migrating from PHP 7.3.x to PHP 7.4.x”, I tried to understand the following deprecation description: Unbinding $this when $this is use…