adamtorok96 / bootstrap-table-ajax
Installs: 2 317
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- illuminate/database: ^5.4
- illuminate/http: ^5.4
- illuminate/support: ^5.4
This package is not auto-updated.
Last update: 2024-12-22 04:01:35 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()
;
}
}