adamtorok96/bootstrap-table-ajax

1.1.2 2018-03-23 14:46 UTC

This package is not auto-updated.

Last update: 2024-04-28 00:43:11 UTC


README

Links

Bootstrap (data) tables
Laravel

Install

composer require composer require adamtorok96/bootstrap-table-ajax

Into config/app.php put this under providers:

AdamTorok96\BootstrapTableAjax\BootstrapTableAjaxServiceProvider::class,

Into config/app.php put this under aliases:

'AjaxResponse'  => AdamTorok96\BootstrapTableAjax\Facades\AjaxResponse::class,

Usage

Example #1

use AdamTorok96\BootstrapTableAjax\AjaxResponse;

class UsersController extends Controller
{
    public function index(Request $request)
    {
        return AjaxResponse::base(User::query(), $request)
            ->search([
                'name',
                'email'
            ])
            ->orderBy('name')
            ->get()
        ;
    }   
}

Example #2

use AdamTorok96\BootstrapTableAjax\AjaxResponse;

class NewsController extends Controller
{
    public function index(Ajax $request)
    {
        return AjaxResponse::base(News::query(), $request)
            ->search([
                'title',
                'author.name'
            ])
            ->orderBy('title')
            ->with([
                'author'
            ])
            ->withCount([
                'comments'
            ])
            ->get()
        ;
    }
}