adamtorok96 / bootstrap-table-ajax
1.1.2
2018-03-23 14:46 UTC
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-09-29 02:46:01 UTC
README
链接
安装
composer require adamtorok96/bootstrap-table-ajax
在 config/app.php 中将以下内容添加到 providers 部分
AdamTorok96\BootstrapTableAjax\BootstrapTableAjaxServiceProvider::class,
在 config/app.php 中将以下内容添加到 aliases 部分
'AjaxResponse' => AdamTorok96\BootstrapTableAjax\Facades\AjaxResponse::class,
用法
示例 #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()
;
}
}
示例 #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()
;
}
}