Download the PHP package kiroushi/laravel-db-blade without Composer
On this page you can find all versions of the php package kiroushi/laravel-db-blade. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-db-blade
Laravel DB Blade
Render Blade templates from Eloquent Model Fields
This package allows you to render Blade templates from a database model instead of files. It is based on Flynsarmy's laravel-db-blade-compiler.
Installation
You can install the package via composer:
Publish the assets using artisan:
And then set up your DbView model in the config/db-blade.php
configuration file. A default model (Kiroushi\DbBlade\Models\DbView) is included in the package:
After the configuration and ensuring that the migration has been published, you can create the database views table by running the migrations:
Usage
This package offers a DbView
facade with the exact same syntax and functionality than View
:
You can also use the dbview()
helper matching Laravel's base view()
helper functionality. If no arguments are supplied, the factory is returned:
If a string is supplied, a view with that name will be looked up for and rendered:
Overriding settings at runtime
You can override individual settings for the model, name field and content field by using associated methods:
Cache
By default, cache is disabled in config file. If you enable the setting, a compiled version of the views will be stored at the desired path. If the model is updated, the updated_at field will be checked against the file modification date and the view will be re-rendered and cached.
Changelog
Please see CHANGELOG for more information on what has changed recently.
To do list
- Expose view finder callback
- Separate standard view composers from dbview composers.
- Unit tests
License
laravel-db-blade is open-sourced software licensed under the MIT License (MIT). Please see License File for more information.