Download the PHP package webkleur/builder without Composer
On this page you can find all versions of the php package webkleur/builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webkleur/builder
More information about webkleur/builder
Files in webkleur/builder
Package builder
Short Description A package to easily integrate GrapesJS into your laravel project.
License MIT
Informations about the package builder
Webkleur Laravel Builder
This package provide an easy way to integrate GrapesJS into your laravel project.
Installation
composer require webkleur/builder
Publish files & migrate
php artisan vendor:publish --tag="laravel-grapesjs"
php artisan migrate
Getting started
-
Add 'gjs_data' column to the model's database table (e.g Page), for which you are going to use the editor.
-
Implement Editable Interface and use the EditableTrait trait for the Model class
-
Next Create a Route for editor
-
In your controller, use the EditorTrait and add the editor method
- Open this route /pages/:page_id/editor (where the :page_id is the id of your model)
Placeholders
Placeholders are like short-code in wordpress. The syntax of placeholder is
[[This-Is-Placeholder]]
Create a file named "this-is-placeholder.blade.php" in "/resources/views/vendor/laravel-grapesjs/placeholders" directory.
The placeholder will be replaced by the content of the relative blade file "this-is-placeholder.blade.php"
Templates
You can create global templates (or blocks) in the "/resources/views/vendor/laravel-grapesjs/templates" directory. And the templates/blocks will be available in the block section of editor. You can also create model specific templates/blocks by defining getTemplatesPath/getGjsBlocksPath in model
This will look for templates under "laravel-grapesj::pages_templates" directory.
You can also return null from these methods to hide templates/blocks for any model.
Display output
The "Editable" model (e.g. Page) will have two public properties, css and html. In your blade file you can use these properties to display the content.
Thank you for using.