getHtmlBuilder() public method

Get html builder class.
public getHtmlBuilder ( ) : Builder
return Yajra\Datatables\Html\Builder
コード例 #1
5
 /**
  * @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>&nbsp;';
                 } 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
0
 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
0
 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
0
ファイル: _ide_helper.php プロジェクト: alexsynarchin/Itnk5
 /**
  * Get html builder class.
  *
  * @return \Yajra\Datatables\Html\Builder 
  * @static 
  */
 public static function getHtmlBuilder()
 {
     return \Yajra\Datatables\Datatables::getHtmlBuilder();
 }
コード例 #5
0
ファイル: DataTable.php プロジェクト: rikardote/agenda
 /**
  * Get Datatables Html Builder instance.
  *
  * @return \Yajra\Datatables\Html\Builder
  */
 public function builder()
 {
     return $this->datatables->getHtmlBuilder();
 }