PHP code example of kiroushi / laravel-db-blade

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

    

kiroushi / laravel-db-blade example snippets


return [

    'model_name' => 'Kiroushi\DbBlade\Models\DbView',
    'table_name' => 'db_views',

    /**
     * The default name field used to look up for the model.
     * e.g. DbView::make($viewName) or dbview($viewName)
     */
    'name_field' => 'name',

    /**
     * The default model field to be compiled when not explicitly specified
     * with DbView::field($fieldName) or DbView::model($modelName, $fieldName)
     */
    'content_field' => 'content',

    /**
     * This property will be added to models being compiled with DbView
     * to keep track of which field in the model is being compiled
     */
    'model_property' => '__db_blade_compiler_content_field',

    'cache' => false,
    'cache_path' => 'app/db-blade/cache/views'

];

return DbView::make('home')->with(['foo' => 'bar']);

return dbview()->make('home')->with(['foo' => 'bar']);

return dbview('home')->with(['foo' => 'bar']);

return DbView::make('home')->model('App\Template');

return DbView::make('home')->field('template_name');

// You can also pass the model and name field as a shorthand:
return DbView::make('home')->model('App\Template', 'template_name');

// Override content field
return DbView::make('home')->contentField('template_content');

// ... or a combination of these
return DbView::make('home')->model('App\Template', 'template_name')->contentField('template_content');
bash
php artisan vendor:publish
bash
php artisan migrate