2017 © Pedro Peláez
 

library db-blade-compiler

Render Blade templates from Eloquent Model Fields

image

flynsarmy/db-blade-compiler

Render Blade templates from Eloquent Model Fields

  • Tuesday, December 12, 2017
  • by flynsarmy
  • Repository
  • 8 Watchers
  • 110 Stars
  • 80,420 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 32 Forks
  • 11 Open issues
  • 13 Versions
  • 10 % Grown

The README.md

DB Blade Compiler

Render Blade templates from Eloquent Model Fields

This package generates and returns a compiled view from a blade-syntax field in your Eloquent model., (*1)

Installation (Laravel v < 5)

Require this package in your composer.json and run composer update (or run composer require flynsarmy/db-blade-compiler:1.* directly):, (*2)

"flynsarmy/db-blade-compiler": "1.*"

After updating composer, add the ServiceProvider to the providers array in app/config/app.php, (*3)

'Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider',

and the Facade to the aliases array in the same file, (*4)

'DbView'          => 'Flynsarmy\DbBladeCompiler\Facades\DbView',

You can also optionally publish the config-file, (*5)

php artisan config:publish flynsarmy/db-blade-compiler

Installation (Laravel 5.x)

Require this package in your composer.json and run composer update (or run composer require flynsarmy/db-blade-compiler:2.* directly):, (*6)

"flynsarmy/db-blade-compiler": "*"

The DbBladeCompilerServiceProvider is auto-discovered and registered by default, but if you want to register it yourself:
add the ServiceProvider to the providers array in app/config/app.php, (*7)

'Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider',

and the DbView facade is also auto-discovered, but if you want to add it manually:
add the Facade to the aliases array in config/app.php, (*8)

'DbView'          => 'Flynsarmy\DbBladeCompiler\Facades\DbView',

You have to also publish the config-file, (*9)

php artisan vendor:publish --provider="Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider"

Usage

This package offers a DbView facade with the same syntax as View but accepts a Model instance instead of path to view., (*10)

$template = Template::first();
return DbView::make($template)->with(['foo' => 'Bar'])->render();

Because you're passing a model to DbView::make(), db-blade-compiler needs to know which field to compile. By default this is content however you can set the field used with either of the following methods:, (*11)

return DbView::make($template, ['foo' => 'Bar'], [], 'excerpt')->render();
return DbView::make($template)->field('excerpt')->with(['foo' => 'Bar'])->render();

You may set the default column used in the package config. You can enable using cache in compiling view from a blade-syntax field in your Eloquent model operation by enabling cache config in package config. By default this option is disabled., (*12)

License

db-blade-compiler is open-sourced software licensed under the MIT license, (*13)

The Versions

12/12 2017

dev-master

9999999-dev

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

12/12 2017

5.4.3

5.4.3.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

08/09 2017

5.4.2

5.4.2.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

29/03 2017

5.4.1

5.4.1.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

14/02 2017

5.4.0

5.4.0.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

29/03 2016

v3.0.0

3.0.0.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

16/06 2015

v2.0.2

2.0.2.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

09/06 2015

dev-revert-11-master

dev-revert-11-master

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

08/06 2015

v2.0.1

2.0.1.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

07/06 2015

v2.0.0

2.0.0.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

16/07 2014

v1.0.2

1.0.2.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

11/04 2014

v1.0.1

1.0.1.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel eloquent model blade compiler

28/12 2013

v1.0.0

1.0.0.0

Render Blade templates from Eloquent Model Fields

  Sources   Download

The Requires

  • php >=5.3.0