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
Step 7. Migrate the tables into the MySQL database. Write 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
- How to Login with Token in Laravel PHP Framework? - October 30, 2021
- How to merge two or multiple tables to each other in the Laravel PHP Framework? (Part-4) - October 29, 2021
- How to display a table in a Verticle or Horizontal form in the Laravel PHP Framework? Part-2 - October 29, 2021