本文整理汇总了PHP中Datatable::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatable::query方法的具体用法?PHP Datatable::query怎么用?PHP Datatable::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datatable
的用法示例。
在下文中一共展示了Datatable::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDatatable
public function getDatatable()
{
$clients = $this->clientRepo->find(Input::get('sSearch'));
return Datatable::query($clients)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('name', function ($model) {
return link_to('clients/' . $model->public_id, $model->name);
})->addColumn('first_name', function ($model) {
return link_to('clients/' . $model->public_id, $model->first_name . ' ' . $model->last_name);
})->addColumn('email', function ($model) {
return link_to('clients/' . $model->public_id, $model->email);
})->addColumn('created_at', function ($model) {
return Utils::timestampToDateString(strtotime($model->created_at));
})->addColumn('last_login', function ($model) {
return Utils::timestampToDateString(strtotime($model->last_login));
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, $model->currency_id);
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . URL::to('clients/' . $model->public_id . '/edit') . '">' . trans('texts.edit_client') . '</a></li>
<li class="divider"></li>
<li><a href="' . URL::to('invoices/create/' . $model->public_id) . '">' . trans('texts.new_invoice') . '</a></li>
<li><a href="' . URL::to('payments/create/' . $model->public_id) . '">' . trans('texts.new_payment') . '</a></li>
<li><a href="' . URL::to('credits/create/' . $model->public_id) . '">' . trans('texts.new_credit') . '</a></li>
<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_client') . '</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_client') . '</a></li>
</ul>
</div>';
})->make();
}
示例2: getDatatable
public function getDatatable($clientPublicId = null)
{
$credits = $this->creditRepo->find($clientPublicId, Input::get('sSearch'));
$table = Datatable::query($credits);
if (!$clientPublicId) {
$table->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('client_name', function ($model) {
return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
});
}
return $table->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, $model->currency_id);
})->addColumn('credit_date', function ($model) {
return Utils::fromSqlDate($model->credit_date);
})->addColumn('private_notes', function ($model) {
return $model->private_notes;
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans('texts.archive_credit') . '</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans('texts.delete_credit') . '</a></li>
</ul>
</div>';
})->make();
}
示例3: getClientDatatable
public function getClientDatatable()
{
$search = Input::get('sSearch');
$invitationKey = Session::get('invitation_key');
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->with('contact.client')->first();
if (!$invitation) {
return [];
}
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted) {
return [];
}
$payments = $this->paymentRepo->findForContact($invitation->contact->id, Input::get('sSearch'));
return Datatable::query($payments)->addColumn('invoice_number', function ($model) {
return $model->invitation_key ? link_to('/view/' . $model->invitation_key, $model->invoice_number) : $model->invoice_number;
})->addColumn('transaction_reference', function ($model) {
return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>';
})->addColumn('payment_type', function ($model) {
return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : '');
})->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
})->addColumn('payment_date', function ($model) {
return Utils::dateToString($model->payment_date);
})->make();
}
示例4: getDatatable
public function getDatatable()
{
$products = $this->ProductRepo->find(Input::get('sSearch'));
return Datatable::query($products)->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
})->addColumn('product_key', function ($model) {
return link_to('products/' . $model->public_id, $model->product_key);
})->addColumn('notes', function ($model) {
return nl2br(Str::limit($model->notes, 50));
})->addColumn('cost', function ($model) {
return Utils::formatMoney($model->cost, 1);
})->addColumn('name', function ($model) {
return nl2br($model->category_name);
})->addColumn('dropdown', function ($model) {
return '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . URL::to('products/' . $model->public_id) . '/edit">' . uctrans('texts.edit_product') . '</a></li>
<li class="divider"></li>
<li><a href="' . URL::to('products/' . $model->public_id) . '/archive">' . uctrans('texts.delete_product') . '</a></li>
</ul>
</div>';
})->make();
}
示例5: buscar_registros_dt
public function buscar_registros_dt()
{
return \Datatable::query($this->repo_main->buscar_todos_dt())->addColumn('descripcion', function ($model) {
return $model->denominacion;
})->addColumn('esta_vigente', function ($model) {
if ($model->esta_vigente == 1) {
return '<i class="fa fa-check-square-o"></i>';
} else {
return '<i class="fa fa-square-o"></i>';
}
})->addColumn('nivel_nacional', function ($model) {
if ($model->nivel_nacional == 1) {
return '<i class="fa fa-check-square-o"></i>';
} else {
return '<i class="fa fa-square-o"></i>';
}
})->addColumn('nivel_zonal', function ($model) {
if ($model->nivel_zonal == 1) {
return '<i class="fa fa-check-square-o"></i>';
} else {
return '<i class="fa fa-square-o"></i>';
}
})->addColumn('nivel_distrital', function ($model) {
if ($model->nivel_distrital == 1) {
return '<i class="fa fa-check-square-o"></i>';
} else {
return '<i class="fa fa-square-o"></i>';
}
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('seguridades/roles/editar') . '/' . Crypt::encrypt($model->id_rol) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('seguridades/roles/eliminar') . '/' . Crypt::encrypt($model->id_rol) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>' . '<a href="' . url('seguridades/roles/permisos/listar') . '/' . Crypt::encrypt($model->id_rol) . '" class="btn btn-primary btn-xs btn-mini"><i class="fa fa-bars"></i> permisos</a>' . '</div>';
})->searchColumns('denominacion', 'denominacion_visual', 'esta_vigente', 'nivel_nacional', 'nivel_zonal', 'nivel_distrital')->orderColumns('denominacion', 'denominacion_visual', 'esta_vigente', 'nivel_nacional', 'nivel_zonal', 'nivel_distrital')->make();
}
示例6: getDatatable
public function getDatatable($accountId, $clientPublicId = null, $entityType, $search)
{
$query = $this->getInvoices($accountId, $clientPublicId, $search)->where('invoices.is_quote', '=', $entityType == ENTITY_QUOTE ? true : false);
$table = \Datatable::query($query);
if (!$clientPublicId) {
$table->addColumn('checkbox', function ($model) {
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '">';
});
}
$table->addColumn("invoice_number", function ($model) use($entityType) {
return link_to("{$entityType}s/" . $model->public_id . '/edit', $model->invoice_number);
});
if (!$clientPublicId) {
$table->addColumn('client_name', function ($model) {
return link_to('clients/' . $model->client_public_id, Utils::getClientDisplayName($model));
});
}
$table->addColumn("invoice_date", function ($model) {
return Utils::fromSqlDate($model->invoice_date);
})->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
});
if ($entityType == ENTITY_INVOICE) {
$table->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, $model->currency_id);
});
}
return $table->addColumn('due_date', function ($model) {
return Utils::fromSqlDate($model->due_date);
})->addColumn('invoice_status_name', function ($model) {
return $model->invoice_status_name;
})->addColumn('dropdown', function ($model) use($entityType) {
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
' . trans('texts.select') . ' <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="' . \URL::to("{$entityType}s/" . $model->public_id . '/edit') . '">' . trans("texts.edit_{$entityType}") . '</a></li>
<li><a href="' . \URL::to("{$entityType}s/" . $model->public_id . '/clone') . '">' . trans("texts.clone_{$entityType}") . '</a></li>
<li class="divider"></li><li>';
if ($entityType == ENTITY_INVOICE) {
$str .= '<a href="' . \URL::to('payments/create/' . $model->client_public_id . '/' . $model->public_id) . '">' . trans('texts.enter_payment') . '</a></li>';
if ($model->quote_id) {
$str .= '<li><a href="' . \URL::to("quotes/{$model->quote_id}/edit") . '">' . trans("texts.view_quote") . '</a></li>';
}
} else {
if ($entityType == ENTITY_QUOTE) {
if ($model->quote_invoice_id) {
$str .= '<li><a href="' . \URL::to("invoices/{$model->quote_invoice_id}/edit") . '">' . trans("texts.view_invoice") . '</a></li>';
}
}
}
return $str . '<li class="divider"></li>
<li><a href="javascript:archiveEntity(' . $model->public_id . ')">' . trans("texts.archive_{$entityType}") . '</a></li>
<li><a href="javascript:deleteEntity(' . $model->public_id . ')">' . trans("texts.delete_{$entityType}") . '</a></li>
</ul>
</div>';
})->make();
}
示例7: buscar_registros_dt
public function buscar_registros_dt()
{
return \Datatable::query($this->repo_servicios->buscar_todos_dt())->addColumn('denominacion', function ($model) {
return $model->denominacion;
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('catalogos/servicios_ac/editar') . '/' . Crypt::encrypt($model->id_servicio) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('catalogos/servicios_ac/eliminar') . '/' . Crypt::encrypt($model->id_servicio) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a> ' . '</div>';
})->searchColumns('denominacion')->orderColumns('denominacion')->make();
}
示例8: buscar_registros_dt
public function buscar_registros_dt($id_proceso)
{
return \Datatable::query($this->repo_main->buscar_todos_dt(Crypt::decrypt($id_proceso)))->addColumn('nombre', function ($model) {
return $model->nombre;
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('catalogos/procesos_ac/requisitos/editar') . '/' . Crypt::encrypt($model->id_requisitos) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('catalogos/procesos_ac/requisitos/eliminar') . '/' . Crypt::encrypt($model->id_requisitos) . '" class="btn btn-danger btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>' . '</div>';
})->searchColumns('id_proceso', 'nombre', 'observaciones')->orderColumns('id_proceso', 'nombre', 'observaciones')->make();
}
示例9: buscar_registros_dt
public function buscar_registros_dt($id_rol)
{
return \Datatable::query($this->repo_main->buscar_todos_dt(Crypt::decrypt($id_rol)))->addColumn('modulo', function ($model) {
return $model->modulo;
})->addColumn('agrupador', function ($model) {
return '<small class="text-muted text-xs">' . $model->agrupador . '</small>';
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('seguridades/roles/permisos/eliminar') . '/' . Crypt::encrypt($model->id_rol_modulo) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>' . '</div>';
})->searchColumns('config_rol_modulo.id_rol_modulo', 'config_modulo.descripcion', 'config_modulosubsistema.descripcion')->orderColumns('config_rol_modulo.id_rol_modulo', 'config_modulo.descripcion', 'config_modulosubsistema.descripcion')->make();
}
示例10: buscar_registros_dt
public function buscar_registros_dt($id_provincia)
{
return \Datatable::query($this->repo_main->buscar_todos_dt($id_provincia))->addColumn('denominacion', function ($model) {
return $model->denominacion;
})->addColumn('codigo', function ($model) {
return $model->codigo;
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('catalogos/ciudades/editar') . '/' . Crypt::encrypt($model->id_ciudad) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('catalogos/ciudades/eliminar') . '/' . Crypt::encrypt($model->id_ciudad) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>' . '<a href="' . url('catalogos/parroquias/listar') . '/' . Crypt::encrypt($model->id_ciudad) . '" class="btn btn-warning btn-xs btn-mini"><i class="fa fa-bars"></i> parroquias</a>' . '</div>';
})->searchColumns('denominacion', 'codigo')->orderColumns('denominacion', 'codigo')->make();
}
示例11: datatable
public static function datatable($timestamps = true)
{
$filters = Input::get('filters');
$model = static::getClass();
$query = static::getDTquery(Input::get('trash'), $timestamps);
$query = static::filterDTQuery($filters, $query, $model);
$query = static::selectDTFields($query);
$dataTable = Datatable::query($query);
return $dataTable;
}
示例12: getClientDatatable
public function getClientDatatable($clientId)
{
$query = DB::table('credits')->join('accounts', 'accounts.id', '=', 'credits.account_id')->join('clients', 'clients.id', '=', 'credits.client_id')->where('credits.client_id', '=', $clientId)->where('clients.deleted_at', '=', null)->where('credits.deleted_at', '=', null)->where('credits.balance', '>', 0)->select(DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'), DB::raw('COALESCE(clients.country_id, accounts.country_id) country_id'), 'credits.amount', 'credits.balance', 'credits.credit_date');
$table = \Datatable::query($query)->addColumn('credit_date', function ($model) {
return Utils::fromSqlDate($model->credit_date);
})->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
})->addColumn('balance', function ($model) {
return Utils::formatMoney($model->balance, $model->currency_id, $model->country_id);
})->make();
return $table;
}
示例13: buscar_registros_dt
public function buscar_registros_dt()
{
return \Datatable::query($this->repo_main->buscar_todos_dt())->addColumn('codigo_amie', function ($model) {
return $model->codigo_amie;
})->addColumn('denominacion', function ($model) {
return $model->denominacion;
})->addColumn('ubicacion', function ($model) {
return '<small class="text-muted text-xs">' . $model->ubicacion . '<br>' . $model->ubicacion2 . '</small>';
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('catalogos/ies/editar') . '/' . Crypt::encrypt($model->id_institucion_educativa) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('catalogos/ies/eliminar') . '/' . Crypt::encrypt($model->id_institucion_educativa) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a> ' . '</div>';
})->searchColumns('id_institucion_educativa', 'codigo_amie', 'div_institucion_educativa.denominacion', 'div_distrito.denominacion', 'div_circuito.codigoSemplades', 'div_zona.denominacion', 'div_ciudad.denominacion')->orderColumns('codigo_amie', 'id_institucion_educativa', 'div_institucion_educativa.denominacion')->make();
}
示例14: buscar_registros_dt
public function buscar_registros_dt($id_subsistema)
{
return \Datatable::query($this->repo_main->buscar_todos_dt(Crypt::decrypt($id_subsistema)))->addColumn('descripcion', function ($model) {
return $model->descripcion . ' <small class="text-muted">(' . $model->texto . ')</small>';
})->addColumn('esta_activo', function ($model) {
return '[' . $model->controlador . ']' . '[' . $model->accion . ']';
})->addColumn('icon', function ($model) {
return '<i class="' . $model->icon . '"></i>';
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('seguridades/modulos/detalles/editar') . '/' . Crypt::encrypt($model->id_modulo) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('seguridades/modulos/detalles/eliminar') . '/' . Crypt::encrypt($model->id_modulo) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a>' . '</div>';
})->searchColumns('id_modulo', 'id_subsistema', 'orden', 'descripcion', 'texto', 'accion', 'controlador', 'icon')->orderColumns('id_modulo', 'id_subsistema', 'orden', 'descripcion', 'texto', 'accion', 'controlador', 'icon')->make();
}
示例15: buscar_registros_dt
public function buscar_registros_dt()
{
return \Datatable::query($this->repo_main->buscar_todos_dt())->addColumn('codigoSemplades', function ($model) {
return $model->codigoSemplades;
})->addColumn('zona', function ($model) {
return $model->zona;
})->addColumn('denominacion_institucional', function ($model) {
return $model->denominacion_institucional;
})->addColumn('commands', function ($model) {
return '<div class="btn-group">' . '<a href="' . url('catalogos/distritos/editar') . '/' . Crypt::encrypt($model->id_distrito) . '" class="btn btn-default btn-xs btn-mini "><i class="fa fa-pencil"></i></a>' . '<a href="' . url('catalogos/distritos/eliminar') . '/' . Crypt::encrypt($model->id_distrito) . '" class="btn btn-dark btn-xs btn-mini"><i class="fa fa-trash-o"></i></a> ' . '</div>';
})->searchColumns('div_distrito.id_distrito', 'div_distrito.codigoSemplades', 'div_distrito.denominacion', 'div_distrito.denominacion_institucional', 'div_zona.denominacion')->orderColumns('div_distrito.id_distrito', 'div_distrito.codigoSemplades', 'div_distrito.denominacion', 'div_distrito.denominacion_institucional', 'div_zona.denominacion')->make();
}