PHP code example of babyandy0111 / laraberg

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

    

babyandy0111 / laraberg example snippets


use Babyandy0111\Laraberg\Traits\RendersContent;

class MyModel extends Model {
  use RendersContent;
}

use Babyandy0111\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="Babyandy0111\Laraberg\LarabergServiceProvider"
bash
php artisan vendor:publish --provider="Babyandy0111\Laraberg\LarabergServiceProvider" --tag="public" --force