mjawad096 / laravel-grapesjs

This package provide an esay way to integrate GrapesJS into your laravel proejct.
MIT License
107 stars 54 forks source link

Editor doesn't load the page content and can't save #76

Open kadrian92 opened 1 year ago

kadrian92 commented 1 year ago

I'm trying to use this package in my laravel project.

When I go to this link: http://1.1.1.1:8000/admin/pages/1/editor then the editor loads, but with a blank page. I getting an error in the console tab: The defination for plugin 'gjs-plugin-ckeditor' not found. I haven't changed anything in the config.

Page model:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Dotlogics\Grapesjs\App\Traits\EditableTrait;
use Dotlogics\Grapesjs\App\Contracts\Editable;

class Page extends Model implements Editable
{
    use HasFactory, EditableTrait;

    protected $fillable = ['title', 'content', 'author', 'permalink', 'password', 'status'];

    protected $casts = [
        'password' => 'boolean',
    ];

}

I added use EditorTrait;and the editor method into the PageController :

public function editor(Request $request, Page $page)
    {
        return $this->show_gjs_editor($request, $page);
    }

And the route is Route::get('pages/{page}/editor', [BackendPageController::class, 'editor']);

And I can't save what I doing in the editor because I get a 403 error if I click on the save button.

http://1.1.1.1:8000/laravel-grapesjs/App-Models-Page/1 403 (Forbidden)

You can see everything in the picture:

error

mohamad-supangat commented 1 year ago

do you have gjs_data column on Page model ??

image

this column use to store the grapesjs data

kadrian92 commented 1 year ago

Yes, I added it manually to the pages table as JSON type

rahulalam31 commented 11 months ago

@kadrian92 in your config see laravel-grapejs.php file and check for routes, disable the auth middleware and your 403 will be solved. image