当前位置: 首页>>代码示例>>PHP>>正文


PHP Datatables\Datatables类代码示例

本文整理汇总了PHP中Yajra\Datatables\Datatables的典型用法代码示例。如果您正苦于以下问题:PHP Datatables类的具体用法?PHP Datatables怎么用?PHP Datatables使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Datatables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: search

 /**
  * Process datatables ajax request.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $auth_account = $this->auth_user->account;
     //return all accounts when we are in the system account
     //in a normal account only show the current linked one
     if ($auth_account->isSystemAccount()) {
         $accounts = Account::all();
     } else {
         // retrieve the account as a collection
         $accounts = Account::where('id', '=', $auth_account->id)->get();
     }
     return Datatables::of($accounts)->addColumn('actions', function ($account) {
         $actions = \Form::open(['route' => ['admin.accounts.destroy', $account->id], 'method' => 'DELETE', 'class' => 'form-inline']);
         $actions .= ' <a href="accounts/' . $account->id . '" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-eye-open"></span> ' . trans('misc.button.show') . '</a> ';
         $actions .= ' <a href="accounts/' . $account->id . '/edit" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-edit"></span> ' . trans('misc.button.edit') . '</a> ';
         if ($account->disabled) {
             $actions .= ' <a href="accounts/' . $account->id . '/enable' . '" class="btn btn-xs btn-success"><span class="glyphicon glyphicon-ok-circle"></span> ' . trans('misc.button.enable') . '</a> ';
         } else {
             $actions .= ' <a href="accounts/' . $account->id . '/disable' . '" class="btn btn-xs btn-warning"><span class="glyphicon glyphicon-ban-circle"></span> ' . trans('misc.button.disable') . '</a> ';
         }
         $actions .= \Form::button('<i class="glyphicon glyphicon-remove"></i> ' . trans('misc.button.delete'), ['type' => 'submit', 'class' => 'btn btn-danger btn-xs']);
         $actions .= \Form::close();
         return $actions;
     })->make(true);
 }
开发者ID:ihatehandles,项目名称:AbuseIO,代码行数:30,代码来源:AccountsController.php

示例2: 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>&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);
     }
 }
开发者ID:pinnaclesoftware,项目名称:Work-Tracking-System,代码行数:41,代码来源:UserController.php

示例3: 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'));
 }
开发者ID:retailone,项目名称:retailone,代码行数:9,代码来源:ClientController.php

示例4: 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'));
 }
开发者ID:retailone,项目名称:retailone,代码行数:10,代码来源:StoreController.php

示例5: index

 /**
  * @param Request $request
  * @param Datatables $dataTable
  * @return \Illuminate\Http\JsonResponse|View
  */
 public function index(Request $request, Datatables $dataTable)
 {
     if ($request->ajax()) {
         return $dataTable->eloquent($this->prepareModelQuery())->addColumn('action', function ($record) {
             return $this->getActionButtons($record);
         })->make(true);
     }
     $this->viewData['model'] = $this->model;
     return view('ignicms::admin.layouts.list', $this->viewData);
 }
开发者ID:despark,项目名称:ignicms,代码行数:15,代码来源:AdminController.php

示例6: test_datatables_make_with_data_and_uses_mdata

 public function test_datatables_make_with_data_and_uses_mdata()
 {
     $builder = $this->setupBuilder();
     // set Input variables
     $this->setupInputVariables();
     $datatables = new Datatables(Request::capture());
     $response = $datatables->usingCollection($builder)->make(true);
     $actual = $response->getContent();
     $expected = '{"draw":1,"recordsTotal":2,"recordsFiltered":2,"data":[{"id":1,"name":"foo"},{"id":2,"name":"bar"}]}';
     $this->assertInstanceOf('Illuminate\\Http\\JsonResponse', $response);
     $this->assertEquals($expected, $actual);
 }
开发者ID:ntamvl,项目名称:laravel-datatables,代码行数:12,代码来源:TestDatatablesCollectionEngine.php

示例7: data

 public function data(Datatables $datatables, $complete = false)
 {
     $user = $this->agent->find(auth()->user()->id);
     if ($complete) {
         $collection = $user->getTickets(true);
     } else {
         $collection = $user->getTickets();
     }
     $collection->join('users', 'users.id', '=', 'ticketit.user_id')->join('ticketit_statuses', 'ticketit_statuses.id', '=', 'ticketit.status_id')->join('ticketit_priorities', 'ticketit_priorities.id', '=', 'ticketit.priority_id')->join('ticketit_categories', 'ticketit_categories.id', '=', 'ticketit.category_id')->select(['ticketit.id', 'ticketit.subject AS subject', 'ticketit_statuses.name AS status', 'ticketit_statuses.color AS color_status', 'ticketit_priorities.color AS color_priority', 'ticketit_categories.color AS color_category', 'ticketit.id AS agent', 'ticketit.updated_at AS updated_at', 'ticketit_priorities.name AS priority', 'users.name AS owner', 'ticketit.agent_id', 'ticketit_categories.name AS category']);
     $collection = $datatables->of($collection);
     $this->renderTicketTable($collection);
     $collection->editColumn('updated_at', '{{ $updated_at->diffForHumans() }}');
     return $collection->make(true);
 }
开发者ID:darkflamed,项目名称:ticketit,代码行数:14,代码来源:TicketsController.php

示例8: search

 /**
  * Process datatables ajax request.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function search()
 {
     $auth_account = $this->auth_user->account;
     $tickets = Ticket::select('tickets.id', 'tickets.ip', 'tickets.domain', 'tickets.type_id', 'tickets.class_id', 'tickets.status_id', 'tickets.ip_contact_account_id', 'tickets.ip_contact_reference', 'tickets.ip_contact_name', 'tickets.domain_contact_account_id', 'tickets.domain_contact_reference', 'tickets.domain_contact_name', DB::raw('count(distinct events.id) as event_count'), DB::raw('count(distinct notes.id) as notes_count'))->leftJoin('events', 'events.ticket_id', '=', 'tickets.id')->leftJoin('notes', function ($join) {
         // We need a LEFT JOIN .. ON .. AND ..).
         // This doesn't exist within Illuminate's JoinClause class
         // So we use some nesting foo here
         $join->on('notes.ticket_id', '=', 'tickets.id')->nest(function ($join) {
             $join->on('notes.viewed', '=', DB::raw("'false'"));
         });
     })->groupBy('tickets.id');
     if (!$auth_account->isSystemAccount()) {
         // We're using a grouped where clause here, otherwise the filtering option
         // will always show the same result (all tickets)
         $tickets = $tickets->where(function ($query) use($auth_account) {
             $query->where('tickets.ip_contact_account_id', '=', $auth_account->id)->orWhere('tickets.domain_contact_account_id', '=', $auth_account->id);
         });
     }
     return Datatables::of($tickets)->addColumn('actions', function ($ticket) {
         $actions = ' <a href="tickets/' . $ticket->id . '" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-eye-open"></span> ' . trans('misc.button.show') . '</a> ';
         return $actions;
     })->editColumn('type_id', function ($ticket) {
         return trans('types.type.' . $ticket->type_id . '.name');
     })->editColumn('class_id', function ($ticket) {
         return trans('classifications.' . $ticket->class_id . '.name');
     })->editColumn('status_id', function ($ticket) {
         return trans('types.status.abusedesk.' . $ticket->status_id . '.name');
     })->make(true);
 }
开发者ID:ihatehandles,项目名称:AbuseIO,代码行数:34,代码来源:TicketsController.php

示例9: getIncidents

    public function getIncidents()
    {
        $incidents = ITP::select(['ID', 'Title', 'ReportingOrg', 'ImpactDescription', 'BriefDescription', 'IncidentLevel', 'Date', 'Section', 'IncidentOwner', 'Engineer', 'IncidentStatus']);
        $datatables = Datatables::of($incidents)->editColumn('BriefDescription', function ($incident) {
            return '
					<div class="text-semibold"><a href="./incident/' . $incident->ID . '/edit">' . str_limit($incident->Title, 40) . '</a></div>
                    <div class="text-muted">' . str_limit($incident->BriefDescription, 80) . '</div>
				';
        })->removeColumn('Title');
        if ($months = $datatables->request->get('months')) {
            $datatables->where(function ($query) use($months) {
                foreach ($months as $month) {
                    $query->orWhereRaw('MONTH(Date) = ' . $month);
                }
            });
        }
        if ($quarters = $datatables->request->get('quarters')) {
            $datatables->where(function ($query) use($quarters) {
                foreach ($quarters as $quarter) {
                    $query->orWhereRaw('MONTH(Date) = ' . $quarter);
                }
            });
        }
        if ($years = $datatables->request->get('years')) {
            $datatables->where(function ($query) use($years) {
                foreach ($years as $year) {
                    $query->orWhereRaw('YEAR(Date) = ' . $year);
                }
            });
        }
        return $datatables->make(true);
    }
开发者ID:clcarver,项目名称:FacBI,代码行数:32,代码来源:ITPAPI.php

示例10: anyData

 public function anyData()
 {
     $hotel = Hoteluri::with('HoteluriOferte');
     return Datatables::of($hotel)->addColumn('action', function ($hotel) {
         return '<a href="' . url('auth/hoteluri', [$hotel->id, 'edit']) . '"><button type="submit" class="btn btn-primary btn-xs">Modifica</button></a>  ' . \Form::open(['method' => 'DELETE', 'url' => ['auth/hoteluri', $hotel->id], "style" => "display:inline"]) . '<button type="submit" class="btn btn-danger btn-xs" onclick="if(confirm(\'Sigur doriti sa stergeti?\')) return true; else return false; ">Sterge</button>' . \Form::close();
     })->make(true);
 }
开发者ID:prodixx,项目名称:cataloghotelier,代码行数:7,代码来源:HoteluriController.php

示例11: listing

 /**
  * 列出选课日志
  * @author FuRongxin
  * @date    2016-02-06
  * @version 2.0
  * @return  JSON 选课日志
  */
 public function listing()
 {
     $logs = Slog::whereXh(Auth::user()->xh)->orderBy('czsj', 'desc');
     return Datatables::of($logs)->editColumn('czlx', function ($log) {
         return config('constants.log.' . $log->czlx);
     })->make(true);
 }
开发者ID:rxfu,项目名称:student,代码行数:14,代码来源:LogController.php

示例12: fetchInactive

 /**
  * Fetch all inactive employee records.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function fetchInactive()
 {
     $employees = App\Employee::select('EmployeeID', DB::raw('CONCAT(LastName, ", ", FirstName, " ",MiddleName) AS FullName'), 'EmailAddress')->where('Status', '=', '0')->orderBy('LastName')->get();
     return Datatables::of($employees)->addColumn('action', function ($employee) {
         return '<a href="/employees/' . $employee->EmployeeID . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-search"></i> View</a>&nbsp;' . '<a href="/employees/' . $employee->EmployeeID . '/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>&nbsp;';
     })->make(true);
 }
开发者ID:ajamiscosa,项目名称:devexam,代码行数:12,代码来源:EmployeeController.php

示例13: data

 public function data($mes, $anio, $legajos, $conceptos)
 {
     if ($legajos == 'todos') {
         if ($conceptos == 'todos') {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         } else {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         }
     } else {
         if ($conceptos == 'todos') {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->DelLegajo($legajos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         } else {
             $conceptosVariables = ConceptoVariable::with('Concepto')->with('Empleado')->DelPeriodo($mes, $anio)->DelLegajo($legajos)->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad", "mes", "anio"));
         }
     }
     //return $conceptos = Concepto::with('EsVariableDe')->where('esfijo', '!=', 'S')
     //    ->where('anio',$year)->get();
     return Datatables::of($conceptosVariables)->add_column('actions', '
         				<div class="btn-group" align="center">
                              <a class="btn btn-primary btn-xs" type="button" data-toggle="modal"
                                id="btnUpdateVariable" data-target="#confirmUpdateConceptoVariable"
                                data-mes="{{$mes}}" data-anio="{{$anio}}" data-concepto_id="{{$concepto_id}}"
                               data-employees_id="{{$employees_id}}"  data-importe="{{$importe}}" data-cantidad="{{$cantidad}}"
                                data-id="{{{ URL::to(\'conceptovariable/\' . $id   ) }}}">
                                 <i class="fa fa-pencil" aria-hidden="true"></i>Editar
                             </a>
                         <a class="btn btn-xs btn-danger" type="button" data-toggle="modal" data-target="#confirmDeletegr"  data-id="{{{ URL::to(\'conceptovariable/\' .$id . \'/delete\' ) }}}" data-title="Delete Type" data-message="Are you sure to delete this Option ?" >
                         <i class="fa fa-trash-o" aria-hidden="true"></i>Delete</a>
                         </div>
                     	')->make(true);
 }
开发者ID:gabrieljaime,项目名称:Payroll-Laravel5,代码行数:31,代码来源:ConceptoVariableController.php

示例14: dataFijo

 public function dataFijo($categoria)
 {
     if ($categoria == 'todos') {
         $conceptosfijos = ConceptoCategory::with('Concepto')->with('Categoria')->get(array("id", "concepto_id", "categoria_id", "cantidad", "importe"));
     } else {
         $conceptosfijos = ConceptoCategory::with('Concepto')->with('Categoria')->DelaCategoria($categoria)->get(array("id", "concepto_id", "categoria_id", "cantidad", "importe"));
     }
     //var action= $(e.relatedTarget).attr('data-id');
     //var concepto_id = $(e.relatedTarget).attr('data-concepto_id');
     //var concepto = $(e.relatedTarget).attr('data-concepto');
     //var employee_id = $(e.relatedTarget).attr('data-employee_id');
     //var nombre = $(e.relatedTarget).attr('data-nombre');
     //var importe =$(e.relatedTarget).attr('data-importe');
     //        //var cantidad =$(e.relatedTarget).attr('data-cantidad');
     //        "concepto.codigo"},
     //{"targets": [2], "data": "concepto.detalle"
     return Datatables::of($conceptosfijos)->add_column('actions', '
            <div class="btn-group" align="center">
                 <a class="btn btn-xs btn-primary" type="button" data-toggle="modal" data-target="#confirmEditConceptoFijo"
                    data-title="Update Type" data-concepto_id="{{{$concepto["codigo"]}}}" data-concepto="{{{$concepto["detalle"]}}}"
                    data-categoria_id="{{{ $categoria_id }}}" data-categoria="{{{ $categoria["category"] }}}"
                    data-importe="{{{ $importe }}}" data-cantidad="{{{ $cantidad }}}"
                    data-id="{{{ URL::to(\'conceptos/categorias/\' .$id   ) }}}">
                     <i class="fa fa-pencil" aria-hidden="true"></i>Edit</a>
                 <a class="btn btn-xs btn-danger" type="button" data-toggle="modal" data-target="#confirmDeletegr"
                    data-id="{{{ URL::to(\'conceptos/categorias/\' . $id . \'/delete\' ) }}}" data-title="Delete Type"
                    data-message="Are you sure to delete this Option ?">
                     <i class="fa fa-trash-o" aria-hidden="true"></i>Delete</a>
             </div>
                     	')->make(true);
 }
开发者ID:gabrieljaime,项目名称:Payroll-Laravel5,代码行数:31,代码来源:ConceptoCategoryController.php

示例15: getAdminOrganizations

 public function getAdminOrganizations()
 {
     $organizations = \App\Models\Organization::all();
     $datatables = Datatables::of($organizations)->addColumn('document', function ($organization) {
         $orgdocs = $organization->orgdocs;
         if ($orgdocs->count()) {
             $document = 'Загружен';
         } else {
             $document = 'Не Загружен';
         }
         return $document;
     })->addColumn('repetition', function ($organization) {
         $user = $organization->user;
         $documents_movalbes = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'movables')->count();
         $document_value_movables = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'value_movables')->count();
         $document_car = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'car')->count();
         $document_buildings = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'buildings')->count();
         $document_parcels = $user->documents()->whereDocument_typeAndOs_type('residues_entering', 'parcels')->count();
         if ($documents_movalbes > 1 || $document_value_movables > 1 || $document_car > 1 || $document_buildings > 1 || $document_parcels > 1) {
             $repetition = 'Есть повтор';
         } else {
             $repetition = 'Нет';
         }
         return $repetition;
     })->addColumn('action', function ($organization) {
         return '<a href="admin/organization/' . $organization->id . '" class="actions icons"><i class="fa fa-eye"></i></a><a href="/organization/' . $organization->id . '/edit" class="actions icons"><i class="fa fa-pencil-square-o"></i></a>';
     });
     return $datatables->make(true);
 }
开发者ID:alexsynarchin,项目名称:Itnk5,代码行数:29,代码来源:OrganizationController.php


注:本文中的Yajra\Datatables\Datatables类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。