Category: php
Do’s and Don’t for a database maintenance
Here I have listed some do’s and don’ts for a database project. Do’s for a Database Maintenance Project: 1. Regularly perform database backups to prevent data loss in case of system failures or disasters. 2. Monitor database performance metrics such as CPU usage, memory usage, and disk I/O to identify potential bottlenecks. 3. Implement database…
Read MoreSeeding: Array[ReflectionException]Class Array does not exist Error while trying to seed the database in Laravel
While I tried to seed the database in laravel after the migration with the below artisan command, php artisan db:seed I received the below error: Seeding: Array [ReflectionException] Class Array does not exist There are a few possible causes for the error message “ReflectionException: Class Array does not exist” that appears when Laravel tries to use a class that it cannot locate. These include: The class might not have been properly imported or required at the top of the file. The class might not have been properly imported or required at the top of the file. Composer dump-autoload may not be done. I solved this by running the below command: composer update and then run: composer dump-autoload Now run…
Read MoreLaravel JWT AUTH only returns TRUE/FALSE instead of the token
When using Laravel JWT authentication, the default behavior is to return a boolean (`true` or `false`) indicating whether the authentication was successful or not. If you want to receive the token upon successful authentication, you might need to customize the authentication response. Here’s how you can modify Laravel to return the token upon successful authentication…
Read More
Laravel artisan migrate PHP Fatal error: Cannot declare class, because the name is already in use : Solution
When I was trying to migrate a database in Laravel Project using the ‘php artisan migrate‘, I get the below error: php artisan migrate Migration table created successfully. PHP Fatal error: Cannot declare class CreatePasswordResetsTable, because the name is already in use in F:Projectsdatabasemigrations2023_11_28_102415_create_password_resets_table.php on line 7 7 [SymfonyComponentDebugExceptionFatalErrorException] Cannot declare class CreatePasswordResetsTable, because…
Read MoreHow to get the table name with a required column name in MySQL using query
While working on a project we had a big database which contains more than 250 tables. I wanted to get the table name containing a column say “Column A”. We can do it easily with a query. Say now we have a database called as “Test_Database” with lot of tables and columns. Now I want…
Read More
“No Application Encryption Key Has Been Specified” Error in Laravel Application
While creating a new laravel application from the begining, you only need the below things: A terminal PHP-7.0 installed composer installed and available in your path npm installed aad available in your path. After all the above installed in your computer , You can create a new Laravel project from the command prompt: composer create-project laravel/laravel Myapplication…
Read More