PHP code example of aruszala / laraberg

1. Go to this page and download the library: Download aruszala/laraberg library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aruszala / laraberg example snippets


use aruszala\Laraberg\Models\Gutenbergable;

class MyModel extends Model {
  use Gutenbergable;
}

$content // This is the raw content from the Gutenberg editor
$model = new MyModel;

// Add or update the content
$model->lb_content = $content;

// Save the model
$model->save();

// Get the rendered HTML
$model->lb_content;

// Get the raw Gutenberg output, this should be in the target textarea when updating content
$model->lb_raw_content;

class MyModel extends Model {
  use Gutenbergable {
    renderContent as renderLBContent;
  }

  public function renderContent() {
    // Your method
  }
}

Route::group(['prefix' => 'laraberg', 'middleware' => ['web', 'auth']], function() {
  Route::apiResource('blocks', 'aruszala\Laraberg\Http\Controllers\BlockController');
  Route::get('oembed', 'aruszala\Laraberg\Http\Controllers\OEmbedController');
});
bash
php artisan vendor:publish --provider="aruszala\Laraberg\LarabergServiceProvider"

php artisan migrate
bash
php artisan vendor:publish --provider="aruszala\Laraberg\LarabergServiceProvider" --tag="public" --force