Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

How to set a Default image of the user’s profile image in the Laravel PHP Framework?

How to set a Default image of the user’s profile image in the Laravel PHP Framework?

Click Upload Profile Image.

Click Remove Old Profile Image.

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

$  composer create-project --prefer-dist laravel/laravel defaultimage "5.8.*"Code language: JavaScript (javascript)

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


$ cd defaultimage
Mysql Database connection Laravel

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

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

APP_URL=http://localhost/defaultimage/public
DB_DATABASE=defaultimage
DB_USERNAME=rootCode language: JavaScript (javascript)

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

$ php artisan make:auth
Run Project URL

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

$table->string('image')->default('user.png');Code language: PHP (php)
public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->string('image')->default('user.png');
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }Code language: PHP (php)

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

$ php artisan migrate

Step 8. Now, Go to User.php file and write down the following code:-

Step 9. First of all, Link the storage directory. Write the following command:-

$ php artisan storage:link

Step 10. Now, Create images folder and store default image file. C:\xampp\htdocs\defaultimage\public\storage\images.

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

Run Project URL

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
With MotoShare.in, you can book a bike instantly, enjoy doorstep delivery, and ride without worries. Perfect for travelers, professionals, and adventure enthusiasts looking for a seamless mobility solution.

Related Posts

What is Laravel and use cases of Laravel?

What is Laravel? Laravel is an open-source, free PHP web framework designed for the development of web applications following the model-view-controller (MVC) architectural pattern. It was generated…

Read More

Complete guide of Laravel certification courses, tutorials & training

What is Laravel Laravel is a reliable and simple to use open-source PHP framework. It adheres to the model-view-controller pattern of design. Laravel makes use of pre-existing…

Read More

Top 100 laravel interview questions and answers

1) What is Laravel? Laravel is an open-source widely used PHP framework. The platform was intended for the development of web application by using MVC architectural pattern….

Read More

[SOLVED] Laravel : Supervisor FATAL/BACKOFF Exited too quickly (process log may have details)

Problem I’m trying to use Laravel queues with a supervisor but the service is not working properly. When I try to check status:$ sudo supervisorctl status$ laravel-worker:laravel-worker_00:…

Read More

How to Login with Token in Laravel PHP Framework?

How to Login with Token in Laravel PHP Framework? Step 1. Create a new Project, so write down the following command on Git Bash: Step 2. Move…

Read More

Directory Structure Of Laravel Application

devopsschool – This is Project Folder app – The app directory contains the core code of your application. bootstrap – The bootstrap directory contains the app.php file…

Read More