Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

How to Upload Profile Image of Users in LARAVEL?

How to Upload Profile Image of Users in LARAVEL?

Step 1. Create a new Project in Laravel, so open git bash. Write down the following command:-

$ composer create-project --prefer-dist laravel/laravel ProfileImage "5.8.*"

Step 2.  Now, Move to project directory on git Bash, so write down the following command:-

$ cd ProfileImage

Mysql Database connection Laravel

Step 3. So, Create a Database for this and Go to XAMPP server->phpMyAdmin->Click New Database->imagedatabase.

Step 4.  Go to .env file to set the project path and give the project DB_DATABASE name and DB_USERNAME name.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=imagedatabase
DB_USERNAME=root
DB_PASSWORD=

Step 5.  Create the user authentication scaffolding and write down this command:-

$ php artisan make:auth

Step 6. Add image column with default value into database/migrations/create_users_table.php

   $table->string('image')->default('user.png');

Step 7. Migrate the tables into the MySQL databaseWrite the following command in git Base.

$ php artisan migrate

Step 8. Link the storage directory. Write the following command:-

$ php artisan storage:link

Step 9. Go to resources/views/home.blade.php file.

Step 10. Go to User.php file and write down the following code:-

Step 11. Go to layouts/app.blade.php file and write down the following code:-

Step 12. Now, Go to app/Http/Controllers/HomeController.php file

Step 13. Then, go to routes/web.php file and define the route.

Step 14. After that, Use these classes into routes/web.php file

Upload Profile Image

Thanks