PHP code example of asgardcms / block

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

    

asgardcms / block example snippets


 

    // app/Http/Kernel.php
    ...
    protected $middlewareGroups = [
        'web' => [
            ...
            \Modules\Block\Http\Middleware\RenderBlock::class,
        ]
    ...
}


    // Modules/YourModule/Http/frontendRoutes.php
    ...
    // middleware will be applied to this specific route
    $router->get('your-url', 'YourController@method')
        ->middleware(\Modules\Block\Http\Middleware\RenderBlock::class);
    ...
    // middleware will be applied to whole group
    $router->group(['middleware' => \Modules\Block\Http\Middleware\RenderBlock::class], function(Router $router) {
        $router->get('your-url', 'YourController@method');
        ...
    });
    ...
 php
{!! Block::get('block-name') !!}