Files
baodev0andClaude Opus 5.5 46aa138eec feat(admin): IP pool allocation, billing exports, service attachments
- IP pool: sheet import (xlsx/csv) matched by address, bulk allocate/revoke
  with notification email (ip_allocated/ip_revoked), ip_pool_logs history.
- Orders/invoices: Excel export on branded template (BrandedReportWriter),
  shared billing filters, order item service info in list responses.
- Web design quote Excel export; activity log export.
- Service attachments with copy-to-invoice; deployment invoice attachments.
- Customer email attachments stored on disk and attached by path.
- Admin password change endpoint; user.fullname backfill migration;
  orders.user_id backfill from logs.
- Disable deploy workflow until CI/CD is set up.
- Ignore stored customer email and service attachment uploads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 19:58:36 +07:00

73 lines
2.1 KiB
PHP

<?php
namespace App\Repositories\ActivityLog;
use App\Models\ActivityLog;
use App\Repositories\BaseRepository;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Database\Eloquent\Builder;
class ActivityLogRepository extends BaseRepository implements ActivityLogRepositoryInterface
{
public function getModel(): string
{
return ActivityLog::class;
}
public function filter(array $filters, int $perPage = 20): LengthAwarePaginator
{
return $this->query($filters)->latest('id')->paginate($perPage);
}
public function query(array $filters): Builder
{
$query = $this->model->newQuery();
if (!empty($filters['log_name'])) {
$query->where('log_name', $filters['log_name']);
}
if (!empty($filters['event'])) {
$query->where('event', $filters['event']);
}
if (!empty($filters['causer_type'])) {
$query->where('causer_type', $filters['causer_type']);
}
if (!empty($filters['causer_id'])) {
$query->where('causer_id', $filters['causer_id']);
}
if (!empty($filters['causer_name'])) {
$query->where('causer_name', 'like', '%' . $filters['causer_name'] . '%');
}
if (!empty($filters['subject_type'])) {
$query->where('subject_type', 'like', '%' . $filters['subject_type'] . '%');
}
if (!empty($filters['subject_id'])) {
$query->where('subject_id', $filters['subject_id']);
}
if (!empty($filters['ip_address'])) {
$query->where('ip_address', $filters['ip_address']);
}
if (!empty($filters['date_from'])) {
$query->where('created_at', '>=', $filters['date_from'] . ' 00:00:00');
}
if (!empty($filters['date_to'])) {
$query->where('created_at', '<=', $filters['date_to'] . ' 23:59:59');
}
if (!empty($filters['search'])) {
$query->where('description', 'like', '%' . $filters['search'] . '%');
}
return $query;
}
}