本文整理汇总了PHP中Yajra\Datatables\Datatables::of方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatables::of方法的具体用法?PHP Datatables::of怎么用?PHP Datatables::of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yajra\Datatables\Datatables
的用法示例。
在下文中一共展示了Datatables::of方法的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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: getDataTable
/**
* @return mixed
*/
public function getDataTable()
{
$categories = $this->category->select(['id', 'name', 'created_at', 'updated_at']);
return Datatables::of($categories)->addColumn('edit', function ($category) {
return link_to(route('backend.categories.edit', ['category' => $category->id]), 'Edit', ['data-target-model' => $category->id, 'class' => 'btn btn-xs btn-primary']);
})->make(true);
}
示例6: 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);
}
}
示例7: getDataTable
/**
* @return mixed
*/
public function getDataTable()
{
$articles = $this->articlesEntity->select(['id', 'topic', 'created_at', 'updated_at']);
return Datatables::of($articles)->addColumn('edit', function ($article) {
return link_to(route('backend.articles.edit', ['articles' => $article->id]), 'Edit', ['data-target-model' => $article->id, 'class' => 'btn btn-xs btn-primary']);
})->make(true);
}
示例8: data
public function data($legajos, $conceptos)
{
if ($legajos == 'todos') {
if ($conceptos == 'todos') {
$conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
} else {
$conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
}
} else {
if ($conceptos == 'todos') {
$conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->DelLegajo($legajos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
} else {
$conceptosfijos = ConceptoFijo::with('Concepto')->with('Empleado')->DelLegajo($legajos)->DelConcepto($conceptos)->get(array("id", "concepto_id", "employees_id", "importe", "cantidad"));
}
}
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-employees_id="{{{ $employees_id }}}" data-nombre="{{{ \\App\\Models\\Employees::find($employees_id)->nombre }}}"
data-importe="{{{ $importe }}}" data-cantidad="{{{$cantidad}}}"
data-id="{{{ URL::to(\'conceptofijo/\' . $concepto_id . \'/\' . $employees_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(\'conceptofijo/\' . $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);
}
示例9: data
/**
* Show a list of all the languages posts formatted for Datatables.
*
* @return Datatables JSON
*/
public function data()
{
$questions = Question::whereNull('questions.deleted_at')->where('questions.user_id', '=', Auth::id())->join('question_categories', 'question_categories.id', '=', 'questions.question_category_id')->join('answers', 'answers.question_id', '=', 'questions.id')->select(array('questions.id', 'question_categories.name as category', 'questions.content', 'answers.content AS answer_content', 'questions.created_at', 'questions.updated_at'))->orderBy('questions.updated_at', 'DESC');
return Datatables::of($questions)->add_column('actions', '
<a href="{{{ URL::to(\'question/\' . $id . \'/delete\' ) }}}" class="btn btn-sm btn-danger iframe"><span class="glyphicon glyphicon-trash"></span> {{ trans("admin/modal.delete") }}</a>
<input type="hidden" name="row" value="{{$id}}" id="row">')->remove_column('id')->make();
}
示例10: showOrderListAjaxHandler
public function showOrderListAjaxHandler()
{
$objModelOrder = Order::getInstance();
$selectedColumns = ['users.name', 'orders.*', 'plans.plan_name'];
$allOrders = $objModelOrder->getAvaiableUserDetailsFromOrders($selectedColumns);
$orders = new Collection();
$allOrders = json_decode(json_encode($allOrders), true);
$i = 0;
foreach ($allOrders as $order) {
$id = $order['order_id'];
$reAdd = '';
$cancel = '';
if ($order['status'] == 0) {
$status = '<span class="label label-info"><i class="fa fa-clock-o"></i> Pending</span>';
// $reAdd = '<button class="label label-warning" id="reAdd"> Re-add</button>';
// $cancel = '<button class="bond label label-warning" id="cancel" data-id=' . $id . '> Cancel</a>';
// $cancel = '<span class="btn popovers btn-default btn-xs"><i class="fa fa-info-circle"></i> Cancel</span>';
// $reAdd = '<span class="btn popovers btn-default btn-xs"><i class="fa fa-info-circle"></i> Re-Add </span>';
} elseif ($order['status'] == 1) {
$status = '<span class="label label-info"><i class="fa fa-refresh fa-spin"></i>Processing</span>';
} elseif ($order['status'] == 2) {
$status = '<span class="label label-info"><i class="fa fa-refresh fa-spin"></i>Processing</span>';
} elseif ($order['status'] == 3) {
$status = '<span class="label label-primary"><i class="fa fa-check-circle"></i> Completed</span>';
} elseif ($order['status'] == 4) {
$status = 'Failed';
} elseif ($order['status'] == 5) {
$status = '<span class="label label-warning"><i class="fa fa-dollar"></i>Refunded</span>';
} else {
$status = '<span class="label label-danger"><i class="fa fa-times-circle"></i> Cancelled</span>';
}
$orders->push(['chck' => '<input type="checkbox" class="orderCheckBox" name="checkbox" value="' . $id . '">', 'id' => ++$i, 'order_id' => $order['order_id'], 'by_user_id' => $order['name'], 'plan_id' => $order['plan_name'], 'ins_url' => '<a href="' . $order['ins_url'] . '" target="_blank">' . $order['ins_url'] . '</a>', 'quantity_total' => $order['quantity_total'], 'status' => $status, 'view' => '<a class="btn btn-sm btn-default btn-raised" data-toggle="modal" data-target="#modal1" data-id=' . $id . ' style="margin-left:1%;">details</a>']);
}
return Datatables::of($orders)->make(true);
}
示例11: productData
/**
* @param $id
* @param Request $request
* @return mixed
* 获取商品详情
*/
public function productData($id)
{
$products = OrderProduct::select('name', 'count')->where('sub_order_id', $id)->get();
//设置table
$datatables = Datatables::of($products);
return $datatables->make(true);
}
示例12: 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);
}
示例13: 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> ' . '<a href="/employees/' . $employee->EmployeeID . '/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a> ';
})->make(true);
}
示例14: 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);
}
示例15: 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);
}