Files
kulakpos_web/Modules/Business/App/Exports/ExportPartyLossProfit.php
eko54r 05fd3230b8
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 5m14s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s
Build, Push and Deploy / deploy-staging (push) Successful in 41s
Build, Push and Deploy / deploy-production (push) Has been skipped
update marketing
2026-05-14 11:55:22 +07:00

28 lines
794 B
PHP

<?php
namespace Modules\Business\App\Exports;
use App\Models\Party;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
class ExportPartyLossProfit implements FromView
{
public function view(): View
{
$parties = Party::with('sales')
->where('business_id', auth()->user()->business_id)
->where('type', '!=', 'Supplier')
->when(request('search'), function ($query) {
$query->where(function ($q) {
$q->where('name', 'like', '%' . request('search') . '%');
});
})
->latest()
->limit(request('per_page') ?? 20)
->get();
return view('business::party-reports.loss-profit.excel-csv', compact('parties'));
}
}