在我们的应用程序中,我们有一个名为Reports的模块,在这个报告中,我们将向您展示模块的总结。
示例
General Journal Report - in this report will show you the summarize of the general journal module.现在,在我们的报告中,需要实现分页,在查询生成器中应用分页存在问题。
控制器
$general_journals = GeneralJournalReportModel::getGeneralJournals();
$data['defined_gj'] = GeneralJournalReportItemsController::getDefinedGJById($general_journals);我获取所有普通日志记录,并将其存储在变量general_journals中,然后将其传递到另一个控制器中,以执行其他操作(例如,当列为null时进行一些错误处理)。
模型
public static function getGeneralJournals()
{
return DB::table('general_journals as gj')
->select('gj.id as id',
'gj.number as number',
'gj.posting_date as posting_date',
'gj.remarks as remarks',
'gj.document_reference as document_reference',
'gji.debit_amount as debit_amount',
'gji.credit_amount as credit_amount')
->leftJoin('general_journal_items as gji', 'gj.id', '=', 'gji.general_journal_id')
->where('gj.company_id', Auth::user()->company_id)
->where('gj.approval_status', 3)
->orderBy('gj.id', 'desc')
->simplePaginate(5);
}视图
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 col-lg-12">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover general-journal-report-table" id="gj-report">
<thead class="thead-global">
<tr>
<th id="pj_sequence">Sequence No.</th>
<th id="pj_date">Posting Date</th>
<th id="pj_op">Transaction No.</th>
<th id="4">Document Reference</th>
<th id="5">Remarks</th>
<th id="6">Amount Due</th>
</tr>
</thead>
<tbody class="general-journal-report-details">
@if($defined_gj)
<?php $counter = 0; ;?>
<?php $total_debit = 0; ?>
@foreach($defined_gj as $key => $value)
<?php $counter++;?>
<?php $total_debit += $value->debit ;?>
<tr>
<td class="pj_sequence">{{$counter}}</td>
<td class="pj_date">{{$value->posting_date}}</td>
<td class="pj_op">{!! $value->number !!}</td>
<td>{{$value->doc_ref}}</td>
<td>{{$value->remarks}}</td>
@if($value->debit == '0')
<td></td>
@else
<td align="right"> {{number_format($value->debit,2)}}</td>
@endif
</tr>
@endforeach
<tr>
<td><b>Total</b></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td align="right"> {{number_format($total_debit)}}</td>
</tr>
@endif
</tbody>
</table>
</div>
{{ $general_journals->links() }}
</div>
当我使用link()时,我的按钮没有任何类。
问:我如何在链接按钮上设置一些类?
注意:我尝试了这个{{ $general_journals>links() }},但是它只在前面的按钮上工作(我还想在next按钮中应用这个类)
发布于 2020-03-01 02:02:31
尝尝这个
{{ $general_journals->links('pagination::bootstrap-4') }}用您的laravel引导版替换。
发布于 2020-03-01 02:18:27
如果要自定义分页视图,可以按照此链接https://laravel.com/docs/5.7/pagination#customizing-the-pagination-view进行操作。
https://stackoverflow.com/questions/60471264
复制相似问题