How to integrate TinyMCE Editor in Laravel?

By Hardik Savani April 16, 2024 Category : Laravel

This simple article demonstrates of laravel tinymce editor example. if you have a question about laravel tinymce image upload then I will give a simple example with a solution. I would like to show you how to use tinymce editor in laravel. I would like to show you how to install tinymce in laravel. follow below step for TinyMCE editor in laravel.

you can use TinyMCE rich text box editor with laravel 6, laravel 7, laravel 8, laravel 9, laravel 10 and laravel 11 versions as well.

In this tutorial, we will create a posts table with a title and body column. we will create for with input for the title and TinyMCE rich textbox for the body, Then save it to the database.

Step 1: Install Laravel

This is optional; however, if you have not created the laravel app, then you may go ahead and execute the below command:

composer create-project laravel/laravel example-app

Step 2: Create Post Table and Model

in first step, we need create new migration for adding "posts" table:

php artisan make:migration create_posts_table



use Illuminate\Database\Migrations\Migration;

use Illuminate\Database\Schema\Blueprint;

use Illuminate\Support\Facades\Schema;

return new class extends Migration



* Run the migrations.


* @return void


public function up()


Schema::create('posts', function (Blueprint $table) {








* Reverse the migrations.


* @return void


public function down()





now let's run migration command:

php artisan migrate

now, just create post model and add code as like bellow:



namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;

use Illuminate\Database\Eloquent\Model;

class Post extends Model


use HasFactory;

protected $fillable = [





Step 3: Create Route

In this is step we need to create some routes for listing posts and creating post.



use Illuminate\Support\Facades\Route;

use App\Http\Controllers\PostController;



| Web Routes



| Here is where you can register web routes for your application. These

| routes are loaded by the RouteServiceProvider within a group which

| contains the "web" middleware group. Now create something great!





Step 4: Create Controller

in this step, we need to create PostController and add following code on that file:



namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Models\Post;

class PostController extends Controller



* Write code on Method


* @return response()


public function create()


return view('postsCreate');



* Write code on Method


* @return response()


public function store(Request $request)


$this->validate($request, [

'title' => 'required',

'body' => 'required'


$post = Post::create([

'title' => $request->title,

'body' => $request->body





Step 5: Create Blade Files

here, we need to create blade files for index and create. so let's create one by one files:


<!DOCTYPE html>

<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Laravel TinyMCE Editor Image Upload Example</title>

<link href="" rel="stylesheet">



<div class="container mt-5">

<h1>Laravel TinyMCE Editor Image Upload Example -</h1>

<form method="post" action="{{ route('') }}" enctype="multipart/form-data">


<div class="form-group">


<input type="text" name="title" class="form-control" />


<div class="form-group">


<textarea class="tinymce-editor" name="body"></textarea>


<div class="form-group text-center">

<button type="submit" class="btn btn-success btn-block">Publish</button>




<script src=""></script>

<script src="" referrerpolicy="origin"></script>

<script type="text/javascript">


selector: 'textarea.tinymce-editor',

height: 300,

menubar: false,

plugins: [

'advlist autolink lists link image charmap print preview anchor',

'searchreplace visualblocks code fullscreen',

'insertdatetime media table paste code help wordcount', 'image'


toolbar: 'undo redo | formatselect | ' +

'bold italic backcolor | alignleft aligncenter ' +

'alignright alignjustify | bullist numlist outdent indent | ' +

'removeformat | help',

content_css: '//'





Run Laravel App:

All the required steps have been done, now you have to type the given below command and hit enter to run the Laravel app:

php artisan serve

Now, Go to your web browser, type the given URL and view the app output:



I hope it can help you...