• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    PHP
  • Created almost 11 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Render Blade templates from Eloquent Model Fields

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.

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):

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

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

'Flynsarmy\DbBladeCompiler\DbBladeCompilerServiceProvider',

and the Facade to the aliases array in the same file

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

You can also optionally publish the config-file

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):

"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

'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

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

You have to also publish the config-file

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.

$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:

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.

License

db-blade-compiler is open-sourced software licensed under the MIT license

More Repositories

1

PHPWebSocket-Chat

Flexable and extensible WebSocket chat application example with a PHP server.
PHP
395
star
2

laravel-csv-seeder

Seed your database with CSV files
PHP
256
star
3

Slim-Monolog

Monolog logging support for Slim Framework
PHP
114
star
4

laravel-5-todo-tutorial

A demo application showcasing the various features of Laravel 5
PHP
79
star
5

synty-in-blender

One-click consistent Blender files for all Synty packs!
Python
34
star
6

oc-idehelper-plugin

IDE Helpers for October CMS
PHP
23
star
7

gd-synty-fantasy-heroes-import-scripts

A a set of Godot helper scripts for importing the Synty Modular Fantasy Hero Characters pack
GDScript
20
star
8

GEdit3TabSwitch

Switch tabs with Ctrl+Tab in GEdit 3
Python
18
star
9

gd-interactable-demo

Demonstrates Interactor and Interactable components
GDScript
16
star
10

KODoctrine2

Doctrine 2 module for Kohana 3 and 3.1 with support for auth and session drivers
PHP
16
star
11

gd-character-creation

A simple character creator for Godot 4
GDScript
12
star
12

laravel-form-builder

A simple and intuitive form builder for Laravel 4.
PHP
12
star
13

oc-menu-plugin

Menu Lists plugin for October CMS
PHP
10
star
14

gd-pixpal-tools-addon

Automated material setup on any Imphenzia PixPal asset imports for Godot 4
GDScript
9
star
15

oc-debugbar-plugin

Laravel Debugbar integration plugin for OctoberCMS
PHP
8
star
16

oc-sociallogin-plugin

PHP
7
star
17

oc-dashboardcachewidget-plugin

A simple dashboard widget with a button to clear October's cache.
PHP
7
star
18

cloud-db-backup

Backup your databases to the cloud with this handy command line tool! Currently supports Amazon S3 and Google Docs
PHP
7
star
19

laravel-orchestra-cms

Intuitive file based CMS for Laravel's Orchestra Platform
PHP
5
star
20

wn-sociallogin-plugin

Allows Winter CMS site visitors to register/sign in with their social media accounts
PHP
5
star
21

flynsarmy-paginator

Adds floating (ranged) pagination support to Django's paginator class
Python
4
star
22

wn-contentblocks-plugin

Allow clients to update content blocks directly from the layouts/pages/partials that use them.
PHP
4
star
23

wp-multisite-admin-bar-switcher

A plugin written for WordPress Multi-Site that makes switching between sites easier with large numbers of sites.
PHP
4
star
24

wn-idehelper-plugin

Make development easier with IDE helpers for Winter CMS!
PHP
4
star
25

wp-flyn-firebase-plugin

Uses Google's URL shortener (Firebase) to create short links for your WordPress posts.
PHP
3
star
26

KOZip

Zip module for Kohana 3.1 based on CodeIgniter 2.0.2's Zip module
PHP
3
star
27

wn-imageoptimizer-plugin

Optimizes images automatically on upload/resize
PHP
3
star
28

wn-menu-plugin

Menu Lists plugin for Winter CMS
PHP
2
star
29

ls-module-themedemo

Demo any installed LS theme
PHP
2
star
30

ls-module-pdfinvoice

Generate invoice PDFs with LemonStand
PHP
2
star
31

oc-richcontent-plugin

This October CMS plugin conditionally converts the markup field in CMS - Content area to a richeditor field. This is useful, for example, when you have a CMS - Page with dynamic content on it and you just want to insert a bit of WYSIWYG text easily.
PHP
2
star
32

dfu-guildscurepoison-mod

Adds a Cure Poison service to all Temple Healers in DaggerFall Unity
C#
2
star
33

atom-open-terminal-here

(OS-X Only) Adds a shortcut to Tree View - Open Terminal Here in the context menu
CoffeeScript
2
star
34

dfu-active-effects-mod

Provides a list of active effects directly on the HUD
C#
1
star
35

oc-commentablehtml-plugin

Allows comments to be made with a WYSIWYG editor.
PHP
1
star
36

wp-nivoslider

Nivo Slider for WordPress with CloudFront support
PHP
1
star
37

dfu-citymap-filter-mod

Adds a simple text field for the city map screen that filters out guild/shop/tavern names as you type, making it easier to find your destination in large cities
C#
1
star
38

EldenRing-Save-Backup

Backs up all save files every 30 minutes while Elden Ring is running
Batchfile
1
star
39

oc-sitemap-plugin

Sitemaps for October CMS
PHP
1
star
40

oc-disqus-plugin

Adds a Disqus component for use in OctoberCMS
PHP
1
star
41

oc-commentableratings-plugin

Provides ability to submit a rating along with the other fields in an October CMS Commentable comment.
HTML
1
star
42

wp-flyn-syntax

Simple and JS-free syntax highlighting for WordPress!
PHP
1
star
43

gd-raycast-issue

Demonstrates an issue with Godot 4.0 RayCast3D's 'target_position` not returning a correct position.
GDScript
1
star
44

gd-brokenimport

Demonstrates a bug with the GLTF importer in Godot 3.5.1
1
star
45

wn-relatedrepeater-plugin

Demonstrates a version of the Repeater widget that works with model relations.
PHP
1
star
46

oc-themeselecter-plugin

Lets you demo any installed theme to visitors in October CMS
PHP
1
star
47

ls1-module-sociallogin

Allows users to register and login through Twitter, Facebook, Google and others
PHP
1
star
48

godot4-statemachine-problem

Demonstrates an issue playong StateMachine animations from a OneShot in a BlendTree
GDScript
1
star
49

wp-page-restrict

Page Restrict plugin for WP with patches. Based off http://wordpress.org/plugins/pagerestrict/
PHP
1
star
50

JQuery-UI-Dialog-Tips-n-Tricks

AJAX dialogs. Access options/methods from within the dialog. Know which element opened the dialog
1
star
51

imphenzia-pixpal-godot-41-project

Imphenzia PixPal palette demo scene for Godot 4.1
1
star
52

wp-flyn-image-optimizer-plugin

Automatically compresses and scales down overly large images on upload.
PHP
1
star
53

gd-material-import-override

Automatically overrides materials on import based on their name.
GDScript
1
star
54

atom-reveal-active-file-context

Adds a shortcut to Tree View - Reveal Active File in the context menu
CoffeeScript
1
star