Laravel 7/6 CKEditor with Image Upload

In this tutorial you will learn about the Laravel 7/6 CKEditor with Image Upload and its application with practical example.

In this Laravel 7/6 CKEditor with Image Upload tutorial I will show you how to install and use CKEditor with image upload in laravel. In this tutorial, you will learn to install CKEditor in laravel using the command line. In this step by step guide I also show you how to upload images and files in laravel with CKEditor.

Laravel 7/6 CKEditor with Image Upload

  • Install Laravel
  • Install CKEditor Package in Laravel
  • Register CKEditor package in Laravel
  • Publish the Ckeditor package by command
  • Create Route
  • Generate Controller
  • Create Blade View
  • Upload and Insert Image in laravel using CKEditor

1. Install Laravel

First of all we need to create a fresh laravel project, download and install Laravel using the below command

2. Install CKEditor In Laravel

In this step, we will install CKEditor Package via the composer dependency manager. Use the following command to install CKEditor Package.

3. Register CKEditor package in Laravel

Now, we will register the package in laravel. Go to config/app.php and put the following line to the providers array.

4. Publish the Ckeditor package by command

Now run following command to copy some of the files and folders from ‘vendor\unisharp\laravel-ckeditor’ to ‘public\vendor\unisharp\laravel-ckeditor’.

5. Create Route

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

6. Generate Controller

Now, lets create a controller named CkeditorController using command given below –

After successfully run the above command and create a controller file. Next open your controller and put the below code into your file.

7. Create Blade View

Now we go resource/views and create a file name ckeditor.blade.php. After this we will create a blade file now put the following code in it:

Note:- If the package of ckeditor is having some problem installing your Laravel web application. Then you add the following cdn file to your blade view file:

8. Upload and Insert Image in laravel using CKEditor

Now we have to enable image upload option in ckeditor as following:

Now we will create a route for upload the image in laravel using CKEditor.

Next, open your terminal and run the below command:

Next, we will put the below method in our controller name CKEditor. This method will store the image or files in the server and return the image URL.

In this tutorial we have learn about the Laravel 7/6 CKEditor with Image Upload and its application with practical example. I hope you will like this tutorial.