2017 © Pedro Peláez
 

library laravel-widgetify

help dealing with data in partial view with laravel.

image

unisharp/laravel-widgetify

help dealing with data in partial view with laravel.

  • Tuesday, November 10, 2015
  • by g0110280
  • Repository
  • 4 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Widget generator for Laravel

  • Help you get partial views as widgets

Installation

  1. install package, (*1)

        composer require unisharp/laravel-widgetify
    
  2. edit config/app.php, (*2)

    service provider :, (*3)

        Unisharp\Widget\WidgetServiceProvider::class,
    

    class aliases :, (*4)

        'Widget' => Unisharp\Widget\WidgetFacade::class,
    
  3. publish widget template class, (*5)

        php artisan vendor:publish --tag=widget_example
    

Usage

    Widget::set('side', 'widget-class-name', $args = []]);
    // set widgets with position

    Widget::get('side');
    // get all widgets of a position

Example

  1. in App\Widgets\Block.php :, (*6)

        class Block implements WidgetInterface
        {
            public $view = 'home.widgets.side_html';
    
            public function getData($args)
            {
                return ['html' => \App\Utility::getPageByAlias($args['alias'])];
            }
        }
    
  2. in home.widgets.side_html.blade.php :, (*7)

        @if(!empty($html->content))
            <section class="facebook-plugin">
                {!! $html->content !!}
            </section>
        @endif
    
  3. set widgets in in controller :, (*8)

        \Widget::set('side', 'block', ['alias' => 'side_top_html']);
        \Widget::set('side', 'facebook');
        \Widget::set('side', 'block', ['alias' => 'side_mid_html']);
        \Widget::set('side', 'subscription');
        \Widget::set('side', 'block', ['alias' => 'side_buttom_html']);
    
  4. display widgets in view :, (*9)

        {!! \Widget::get('side') !!}
    

The Versions

10/11 2015

dev-master

9999999-dev

help dealing with data in partial view with laravel.

  Sources   Download

MIT

The Requires

 

laravel widget view render partial