2017 © Pedro Peláez
 

library laravel-table

Simple HTML table builder for laravel 5

image

aayaresko/laravel-table

Simple HTML table builder for laravel 5

  • Tuesday, June 27, 2017
  • by aayaresko
  • Repository
  • 1 Watchers
  • 2 Stars
  • 61 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

Laravel Html table builder

HTML table builder for laravel 5, (*1)

Installation

The preferred way to install extension is via composer. Check the composer.json for this extension's requirements and dependencies. To install, either run, (*2)

$ php composer.phar require aayaresko/laravel-table

or add, (*3)

"aayaresko/laravel-table": "^1.0"

to the require section of your composer.json., (*4)

Configuration

It does not require any additional configuration., (*5)

Usage

Simply create a new instance of TablesFacade and pass to it all required parameters:, (*6)

$table = new TablesFacade($data_provider, $attributes, $default_actions_route);

$data_provider is used as a models source. It should be either an instance of Illuminate\Contracts\Pagination\LengthAwarePaginator or Illuminate\Database\Eloquent\Collection., (*7)

$attributes array holds list of attributes, that should be rendered in each table row. You can use 'dot' syntax to target attribute value of related models:, (*8)

$table = new TablesFacade(
    $data_provider, 
    [
        'nickname',
        'email',
        'profile.full_name',
        'created',        
    ], 
    $default_actions_route
);

In your view you should place something like this:, (*9)

<div class="table-responsive">
    {{ $table->renderTable() }}
    {{ $table->renderLinks() }}
</div>

You scan use renderLinks() method only when you use Illuminate\Contracts\Pagination\LengthAwarePaginator as $data_provider., (*10)

You can specify custom column name for any attribute:, (*11)

$table = new TablesFacade(
    $data_provider, 
    [
        'Alias' => 'nickname',
        'email',
        'Full name' => 'profile.full_name',
    ], 
    $default_actions_route
);

That custom name will be translated automatically., (*12)

You can attach a callback to render any attribute value:, (*13)

$table = new TablesFacade(
    $data_provider, 
    [
        'nickname',
        'email',
        'profile.full_name',
        'created',   
        'alias' => function ($model) {
            return $model->alias;
        }
    ], 
    $default_actions_route
);

Function signature is pretty straightforward: function ($model) {}., (*14)

$default_actions_route is route which will be used as 'parent' to generate links for all action buttons. You can set <$default_actions_route to 'false'., (*15)

You can configure your own list of action buttons via $action_buttons property., (*16)

'show' => [
    'title' => '<i class="glyphicon glyphicon-eye-open"></i>',
    'route' => 'backend.accounts',
],
'edit' => [
    'title' => '<i class="glyphicon glyphicon-pencil"></i>',
    'route' => 'frontend.accounts',
],
'destroy' => [
    'title' => 'My button content',
    'url' => 'backend/accounts/destroy'
    'options' => [
        'class' => 'delete-ajax',
    ]
]

Please be aware that route and url options are mutually exclusive. You can remove $action_buttons column by setting 'false' as $action_buttons value. You can specify any html options for any button via button options array., (*17)

You can specify attributes values for the table itself, tr and td tags of the table via $table_options, $row_options and $item_options respectively. You can specify text, which will be displayed in case of no models via $not_found_text., (*18)

The Versions

27/06 2017

dev-master

9999999-dev

Simple HTML table builder for laravel 5

  Sources   Download

MIT

The Requires

 

by Andrey Yaresko

laravel html table html-table

31/10 2016

v1.0.4

1.0.4.0

Simple HTML table builder for laravel 5

  Sources   Download

MIT

The Requires

 

by Andrey Yaresko

laravel html table html-table

22/10 2016

v1.0.3

1.0.3.0

Simple HTML table builder for laravel 5

  Sources   Download

MIT

The Requires

 

by Andrey Yaresko

laravel html table html-table