In this tutorial im going to learn how to upload profile image of user in Laravel. By default, Laravel gives only registration form includes only the name, email, and password, but usually, it’s helpful to allow the user to upload the image or profile pic. Please follow some easy steps define below.
First let’s go to install laravel project
After Installation setup database So go to the .env file and add the database credentials. lets go to .env folder and put database name and connect to database.
Now migrate the table
Create the user authentication scaffolding and write down this command:-
Next to add image column with default value into database/migrations/create_users_table.php
Link the storage directory. Write the following command:-
Go to resources/views/home.blade.php file, and paste below code
Next go to User.php file and paste below code :-
Next go to layouts/app.blade.php file and paste below code:-
Next go to app/Http/Controllers/HomeController.php file
Next go to routes/web.php file and define the route.
And use below classed in web.php file
Now profile image saved successfully 🙏🙏