本文整理汇总了PHP中Yajra\Datatables\Datatables::getHtmlBuilder方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatables::getHtmlBuilder方法的具体用法?PHP Datatables::getHtmlBuilder怎么用?PHP Datatables::getHtmlBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yajra\Datatables\Datatables
的用法示例。
在下文中一共展示了Datatables::getHtmlBuilder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* @param Request $request
* @param Builder $htmlBuilder
* @return $this This Index function include useless function like removeColumn , I wrote some method for show extra usage of datatable if
* you want more complex datatable query please check the plugin's demo project. PLEASE READ DOCUMENTATION !!!
* LINK =====> https://github.com/yajra/laravel-datatables-demo
*
* YAJRA DATATABLE PLUGINS ......
*/
public function index(Datatables $datatables)
{
if ($this->currentUser->hasAccess('wts.user.show')) {
if ($datatables->getRequest()->ajax()) {
$users = DB::table('users')->select(['id', DB::raw("CONCAT(users.first_name,' ',users.last_name) as full_name"), 'slug', 'phone', 'password', 'email', 'created_at', 'updated_at']);
return Datatables::of($users)->filterColumn('full_name', 'whereRaw', "CONCAT(users.first_name,' ',users.last_name) like ?", ["\$1"])->addColumn('action', function ($user) {
if ($this->currentUser->hasAccess('wts.user.edit')) {
$edit = $this->createEditButton('/admin/users/' . $user->slug . '/edit');
} else {
$edit = '';
}
if ($this->currentUser->hasAccess('wts.user.delete')) {
$delete = $this->createDeleteButton($user->id, 'admin.users.destroy');
} else {
$delete = '';
}
if ($this->currentUser->hasAccess('wts.user.show')) {
$use = '<a href="' . url("admin/users/") . "/" . $user->slug . '/use"
class="btn btn-warning" data-tooltip="true" title="Oturumu Kullan" ><i class="fa fa-user"></i></a> ';
} else {
$use = '';
}
return $use . ' ' . $edit . ' ' . $delete;
})->make(true);
}
$html = $datatables->getHtmlBuilder()->addColumn(['data' => 'full_name', 'name' => 'full_name', 'title' => 'Ad Soyad'])->addColumn(['data' => 'email', 'name' => 'email', 'title' => 'Email'])->addColumn(['data' => 'phone', 'name' => 'phone', 'title' => 'Telefon'])->addColumn(['data' => 'created_at', 'name' => 'created_at', 'title' => 'Created At'])->addColumn(['data' => 'updated_at', 'name' => 'updated_at', 'title' => 'Updated At'])->addColumn(['data' => 'action', 'name' => 'action', 'title' => 'İşlemler', 'orderable' => false, 'searchable' => false])->parameters(array('order' => [3, 'desc']));
$data = ['menu' => 'users', 'page_title' => 'Kullanıcılar', 'page_description' => 'Sistem Kullanıcılara Ait Özellikler Bu Sayfada Yer Almaktadır'];
return view('admin.user-group.user.index', $data)->with(compact('html'));
} else {
abort(403, $this->accessForbidden);
}
}
示例2: index
public function index(Datatables $datatables)
{
$columns = ['id', 'name', 'created_at'];
if ($datatables->getRequest()->ajax()) {
return $datatables->of(Client::select($columns))->make(true);
}
$html = $datatables->getHtmlBuilder()->columns($columns);
return view('backend.admin.clients.index', compact('html'));
}
示例3: show
public function show(Datatables $datatables, $id)
{
$store = Store::findOrFail($id);
$device = Device::findOrFail($id);
if ($datatables->getRequest()->ajax()) {
return $datatables->of(Visitor::select(['type', 'device_id', 'created_at'])->where('device_id', $device->id)->orderBy('created_at', 'desc'))->make(true);
}
$html = $datatables->getHtmlBuilder()->columns(['type', 'created_at']);
return view('backend.admin.stores.show', compact('device', 'store', 'html'));
}
示例4: getHtmlBuilder
/**
* Get html builder class.
*
* @return \Yajra\Datatables\Html\Builder
* @static
*/
public static function getHtmlBuilder()
{
return \Yajra\Datatables\Datatables::getHtmlBuilder();
}
示例5: builder
/**
* Get Datatables Html Builder instance.
*
* @return \Yajra\Datatables\Html\Builder
*/
public function builder()
{
return $this->datatables->getHtmlBuilder();
}