2017 © Pedro Peláez
 

library laravel-table-view

Laravel 5 Package for easily displaying table views for Eloquent Collections.

image

kabbouchi/laravel-table-view

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  • Wednesday, June 6, 2018
  • by KABBOUCHI
  • Repository
  • 2 Watchers
  • 2 Stars
  • 973 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 18 Versions
  • 30 % Grown

The README.md

laravel-table-view

Laravel 5 Package for easily displaying table views for Eloquent Collections., (*1)

Installation

``` bash composer require kabbouchi/laravel-table-view, (*2)

Next, you must install the service provider:

```php
// config/app.php
'providers' => [
    ...
    KABBOUCHI\TableView\TableViewServiceProvider::class,
];

You can publish and add custom styles for table view:, (*3)

php artisan vendor:publish --provider="KABBOUCHI\TableView\TableViewServiceProvider" --tag="tableView"

Usage

    // Collection
    $users = User::all();

    // or

    // Builder
    $users = User::query(); //  User::where('active',true) ...

    tableView($users)->render();

    $users = User::all();

    tableView($users)
           ->column('ID', 'id')
           ->column('Active', 'active','boolean')
           ->column('Featured', 'active','boolean|No,Yes')
           ->column('Photo', 'photo','image')
           ->column('Avatar', 'avatar','image|200,200')
           ->column('full_name') // ->column('Full name','full_name')
           ->column('Created At', function ($model) {
                           return $model->created_at->diffForHumans();
            })
            ->render();
    // tableView with client side pagination (dataTable)

    // controller
    $users = collect([
       (object) ["id" => 1, "user" => "User 1"],
       (object) ["id" => 2, "user" => "User 2"],
       (object) ["id" => 3, "user" => "User 3"],
       (object) ["id" => 4, "user" => "User 4"]

    ]);

    $table = tableView($users)
             ->setTableClass('table table-striped')
             ->useDataTable(); // You need to add @stack('scripts') and @stack('styles') in your main blade template

    // view
     $table->render();

// tableView with server side pagination // controller $users = User::all(); $table = tableView($users) ->column('ID', 'id') ->column('Active', 'active','boolean') ->column('Country', 'country.name') // $user->country->name ->column('Name', 'name:search') // enable search for names ->column('Created At', function ($model) { return $model->created_at->diffForHumans(); }) ->childDetails(function (User $user) { return view('partials.user-details',compact('user')); // return view or string }); ->appendsQueries(true) // or pass an Array for specific queries e.g: ['foo','bar'] ->paginate(); // default 15 // view $table->render();

Specify custom attribute for each tr, (*4)

    $table = tableView(User::all())
                ->setTableRowAttributes([
                    'class' => 'tr-class'
                ]);

Specify custom attribute for each tr using closure, (*5)

    $table = tableView(Category::all()
                ->setTableBodyClass('sortable')
                ->setTableRowAttributes(function (Category $categ) {
                    return [
                        'data-order-id' => $categ->order_index
                    ];
                });

License

The MIT License (MIT). Please see License File for more information., (*6)

The Versions

06/06 2018

dev-master

9999999-dev

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

29/03 2018

v0.1.7

0.1.7.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

27/03 2018

v0.1.6

0.1.6.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

24/03 2018

v0.1.5

0.1.5.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

23/03 2018

v0.1.4

0.1.4.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

23/03 2018

v0.1.3

0.1.3.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

20/09 2017

v0.1.2

0.1.2.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

20/09 2017

v0.1.1

0.1.1.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

31/08 2017

v0.1.0

0.1.0.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

17/07 2017

v0.0.9

0.0.9.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

17/07 2017

v0.0.8

0.0.8.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

17/07 2017

v0.0.7

0.0.7.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

17/07 2017

v0.0.6

0.0.6.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

13/07 2017

v0.0.5

0.0.5.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

13/07 2017

v0.0.4

0.0.4.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

13/07 2017

v0.0.3

0.0.3.0

Laravel 5 Package for easily displaying table views for Eloquent Collections.

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

26/06 2017

v0.0.2

0.0.2.0

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view

26/06 2017

v0.0.1

0.0.1.0

  Sources   Download

MIT

The Requires

 

by Georges KABBOUCHI

laravel table view table-view