2017 © Pedro Peláez
 

library lvlgrid

Grid helper to your Laravel application.

image

mrjj/lvlgrid

Grid helper to your Laravel application.

  • Thursday, April 7, 2016
  • by marcosrjjunior
  • Repository
  • 1 Watchers
  • 7 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

lvlGrid

lvlgrid, (*1)

Documentation


Dependencies

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>

Installation

First, pull in the package through Composer., (*2)

composer require mrjj/lvlgrid

And then include the service provider within app/config/app.php., (*3)

'providers' => [
    Mrjj\LvlGrid\LvlGridServiceProvider::class
];

Getting started

First, create add a route to grid method, (*4)

Route::get('countries/grid', '....Controller@grid');

Use a trait and add a required informations in your controller, (*5)

use Mrjj\LvlGrid\LvlGrid;

class ..Controller extends Controller
{
    use LvlGrid

    protected $gridModel = \App\Models\Country::class;

    protected $threshold = 30;  
    ...
}

Finally, add this @includes(lvlgrid::...) , lvlgrid component and fill your infos, (*6)

@extend('default')

@section('scripts')

    @include('lvlgrid::scripts')

@stop

@section('content')


lvlGrid

@include('lvlgrid::grid') <div id="lvlgrid"> <lvlgrid :data="items" :columns="[{ 'key': 'name', 'name': 'Name' },{ 'key': 'monetary', 'name': 'Monetary unit' }]" :routes="{ function: '/countries/grid', edit: { column: 'id', name: '/countries/:column/edit' }, delete: { column: 'id', name: '/countries/:column/delete' } }"> </lvlgrid> </div> ..

Get Data

Add a gridData() method if you want to customize your query, (*7)

public function gridData()
{
    return DB::table('users')
            ->leftJoin('posts', 'users.id', '=', 'posts.user_id')
}

@return \Illuminate\Database\Query\Builder, (*8)

Transformer

To transform your data you need add a gridTransformer() method and modify what you want, (*9)

public function gridTransformer($data)
{
    foreach($data['items'] as $_grid) {
        $_grid->status = trans('form.status.'.$_grid->status);
    }
 }

In this example I'm changing the status for a friendly name like 'Active' and 'Inactive', (*10)

If you need to modify the views, you can run:, (*11)

php artisan vendor:publish --provider="Mrjj\LvlGrid\LvlGridServiceProvider"

The package views will now be located in the app/resources/views/vendor/mrjj/lvlgrid, (*12)

The Versions

07/04 2016

dev-master

9999999-dev

Grid helper to your Laravel application.

  Sources   Download

by Avatar marcosrjjunior

laravel table grid vuejs datagrid

07/04 2016

V1.0.4

1.0.4.0

Grid helper to your Laravel application.

  Sources   Download

by Avatar marcosrjjunior

laravel table grid vuejs datagrid

18/03 2016

V1.0.3

1.0.3.0

Grid helper to your Laravel application.

  Sources   Download

by Avatar marcosrjjunior

laravel table grid vuejs datagrid

06/03 2016

V1.0.2

1.0.2.0

Grid helper to your Laravel application.

  Sources   Download

by Avatar marcosrjjunior

laravel table grid vuejs datagrid

05/03 2016

V1.0.1

1.0.1.0

Grid helper to your Laravel application.

  Sources   Download

by Avatar marcosrjjunior

laravel table grid vuejs datagrid

01/03 2016

v1.0.0

1.0.0.0

Grid helper to your Laravel application.

  Sources   Download

by Avatar marcosrjjunior

laravel table grid vuejs datagrid