Laravel 9 CKeditor Image Upload Tutorial Example

In this tutorial you will learn about the Laravel 9 CKeditor Image Upload Tutorial Example and its application with practical example.

In this Laravel 9 CKeditor Image Upload Tutorial I will show you how to install and use CKeditor with image upload in laravel 9. In this tutorial, you will learn to install CKeditor with image upload in laravel 9. In this step by step guide you how to integrate CKeditor editor with image upload in laravel 9. Integration of CKeditor editor in laravel form is simple process. I will also show you how to integrate or enable image upload in CKeditor editor.

While creating forms we come to situation where we may text editor field so that we can insert and save html and other text into database. The CKeditor editor is feature rich wysiwyg html editor allows us to integrate text editor fields in html form.

Laravel 9 CKeditor Image Upload Tutorial Example

In this laravel 9 CKeditor with image upload integration example I will guide you through step by step to install and use CKeditor editor with image upload in laravel 9 application. Please follow the instruction given below:

  • Install Laravel 9
  • Install CKEditor Package in Laravel
  • Register CKEditor package in Laravel
  • Publish the Ckeditor package by command
  • Add Route
  • Create Controller Using Artisan Command
  • Create Blade View
  • upload and Insert Image in laravel using CKEditor

Install Laravel 9

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

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.

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.

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’.

Add 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

Create Controller Using Artisan Command

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.

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:


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. Open route/web.php file and add the following route into it:

Next, open your terminal and run the below command:

Next, we will put the below method in our controller. 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 9 CKeditor Image Upload Tutorial Example and its application with practical example. I hope you will like this tutorial.