I have a problem with the following code. When performing the push inside the collection, I have an item with an empty collection when both conditions are false.
$admins = collect(new User);
$owner = collect(new User);
if (config('personal.mailing_technician')) {
$owner = $event->ticket->ownedBy;
}
if (config('personal.mailing_admin')) {
$admins = User::query()->role('admin')->get();
}
$sentTo = $admins->push($owner);
if ($senTo->isNotEmpty()) {
.......
}
What could I do to make it empty if both conditions are false?
To make sure that
$sentTois an empty collection when both conditions are false...