mjawad096 / laravel-grapesjs

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

Not able to create migration #57

Closed repo-tech2edge closed 1 year ago

repo-tech2edge commented 1 year ago

followed the following steps

 composer require jd-dotlogics/laravel-grapesjs
 php artisan vendor:publish --tag="laravel-grapesjs"

then run migration but there was nothing to migrate


namespace App\Models;

use \DateTimeInterface;
use App\Traits\Auditable;
use Dotlogics\Grapesjs\App\Contracts\Editable;
use Dotlogics\Grapesjs\App\Traits\EditableTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

class ContentPost extends Model implements HasMedia,Editable
{
    use SoftDeletes;
    use InteractsWithMedia;
    use Auditable;
    use HasFactory;
    use EditableTrait;
---


namespace App\Http\Controllers\Admin;
use ..
class ContentPostController extends Controller
{
    use MediaUploadingTrait;
    use CsvImportTrait;
    use EditorTrait;
    public function editor(Request $request, ContentPost $page)
    {
        return $this->show_gjs_editor($request, $page);
    }

--


 Route::get('editpage/{page}', 'ContentPostController@editor')->name('content-posts.editor');

then fixed the issue to support 7.4 as per

https://github.com/jd-dotlogics/laravel-grapesjs/pull/49

Now page is working but on saving response is 500 of course because of no columns


{
    "message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'gjs_data' in 'field list' (SQL: update `content_posts` set `gjs_data` = {\"components\":\"[{\\\"type\\\":\\\"text\\\",\\\"content\\\":\\\"

Amazing tool , lets,see what we can do?<\\/p>\\\\n\\\",\\\"attributes\\\":{\\\"id\\\":\\\"iznd\\\"}},{\\\"type\\\":\\\"text\\\",\\\"components\\\":[{\\\"type\\\":\\\"textnode\\\",\\\"content\\\":\\\"\\\\n\\\\tExample Template\\\\n\\\"}]},{\\\"type\\\":\\\"text\\\",\\\"components\\\":[{\\\"type\\\":\\\"textnode\\\",\\\"content\\\":\\\"Example Block\\\"}]}]\",\"styles\":\"[{\\\"selectors\\\":[\\\"#iznd\\\"],\\\"style\\\":{\\\"padding\\\":\\\"10px\\\"}}]\",\"css\":\"* { box-sizing: border-box; } body {margin: 0;}#iznd{padding:10px;}\",\"html\":\"

Amazing tool , lets,see what we can do?<\\/p>\\n<\\/div>

\\n\\tExample Template\\n<\\/div>
Example Block<\\/div><\\/body>\"}, `content_posts`.`updated_at` = 2022-10-06 12:57:00 where `id` = 1)", "exception": "Illuminate\\Database\\QueryException", "file": "C:\\xampp\\htdocs\\coai\\laravel\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php", "line": 712, "trace": [ { "file"

what is missing out here ?

ghost commented 1 year ago

@repo-tech2edge you have to add a 'gjs_data' field to your database table for details please see Readme.md

Ref: https://i.imgur.com/fJ4kBLZ.png