PHP code example of van-ons / laraberg

1. Go to this page and download the library: Download van-ons/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/ */

    

van-ons / laraberg example snippets


use VanOns\Laraberg\Traits\RendersContent;

class MyModel extends Model {
  use RendersContent;
}

use VanOns\Laraberg\Traits\RendersContent;

class MyModel extends Model {
  use RendersContent;

  protected $contentColumn = 'my_column';
}

$model->render('my_column');

class BlockServiceProvider extends ServiceProvider {
    public function boot() {
        Laraberg::registerBlockType(
          'my-namespace/my-block',
          [],
          function ($attributes, $content) {
            return view('blocks.my-block', compact('attributes', 'content'));
          }
        );
    }
}
bash
php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider"
bash
php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider" --tag="public" --force