feat(mail-campaigns): sender info + resolve typed emails against customers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-22 21:18:53 +07:00
co-authored by Claude Opus 5.5
parent 54c14c41d8
commit e1efc88fd2
10 changed files with 277 additions and 18 deletions
@@ -14,6 +14,8 @@ class LeadController extends Controller
{
public function index(Request $request): JsonResponse
{
$request->validate(['date_from' => 'nullable|date', 'date_to' => 'nullable|date']);
$leads = Lead::query()
->with('customer:id,uuid,fullname,email')
->search($request->input('filter'))
@@ -21,6 +23,8 @@ class LeadController extends Controller
->when($request->filled('source'), fn ($query) => $query->where('source', $request->input('source')))
->when($request->input('linked') === '1', fn ($query) => $query->whereNotNull('customer_id'))
->when($request->input('linked') === '0', fn ($query) => $query->whereNull('customer_id'))
->when($request->filled('date_from'), fn ($query) => $query->whereDate('created_at', '>=', $request->input('date_from')))
->when($request->filled('date_to'), fn ($query) => $query->whereDate('created_at', '<=', $request->input('date_to')))
->orderByDesc('id')
->paginate(min(max((int) $request->input('per_page', 20), 1), 100));