Fix Laravel Pint formatting
This commit is contained in:
@@ -4,7 +4,6 @@ namespace App\Services\Events;
|
||||
|
||||
use App\Models\EventCharges;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class EventChargeQueryService
|
||||
{
|
||||
@@ -26,16 +25,16 @@ class EventChargeQueryService
|
||||
->leftJoin('students', 'students.id', '=', 'event_charges.student_id')
|
||||
->leftJoin('events', 'events.id', '=', 'event_charges.event_id');
|
||||
|
||||
if (!empty($filters['school_year'])) {
|
||||
if (! empty($filters['school_year'])) {
|
||||
$query->where('event_charges.school_year', (string) $filters['school_year']);
|
||||
}
|
||||
if (!empty($filters['semester'])) {
|
||||
if (! empty($filters['semester'])) {
|
||||
$query->where('event_charges.semester', (string) $filters['semester']);
|
||||
}
|
||||
if (!empty($filters['parent_id'])) {
|
||||
if (! empty($filters['parent_id'])) {
|
||||
$query->where('event_charges.parent_id', (int) $filters['parent_id']);
|
||||
}
|
||||
if (!empty($filters['event_id'])) {
|
||||
if (! empty($filters['event_id'])) {
|
||||
$query->where('event_charges.event_id', (int) $filters['event_id']);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,7 @@ use App\Services\Invoices\InvoiceGenerationService;
|
||||
|
||||
class EventChargeService
|
||||
{
|
||||
public function __construct(private InvoiceGenerationService $invoiceGeneration)
|
||||
{
|
||||
}
|
||||
public function __construct(private InvoiceGenerationService $invoiceGeneration) {}
|
||||
|
||||
public function seedChargesForEvent(Event $event, string $schoolYear, string $semester, float $amount, int $actorId): array
|
||||
{
|
||||
@@ -82,7 +80,7 @@ class EventChargeService
|
||||
int $actorId
|
||||
): array {
|
||||
$event = Event::getEvent($eventId, $schoolYear);
|
||||
if (!$event) {
|
||||
if (! $event) {
|
||||
return ['ok' => false, 'message' => 'Event not found.'];
|
||||
}
|
||||
|
||||
@@ -109,6 +107,7 @@ class EventChargeService
|
||||
$existing->delete();
|
||||
$deleted++;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,19 +16,19 @@ class EventListService
|
||||
$activeOnly = $filters['active'] ?? null;
|
||||
|
||||
$allowedSorts = ['created_at', 'expiration_date', 'event_name'];
|
||||
if (!in_array($sortBy, $allowedSorts, true)) {
|
||||
if (! in_array($sortBy, $allowedSorts, true)) {
|
||||
$sortBy = 'created_at';
|
||||
}
|
||||
|
||||
$query = Event::query();
|
||||
|
||||
if (!empty($filters['school_year'])) {
|
||||
if (! empty($filters['school_year'])) {
|
||||
$query->where('school_year', (string) $filters['school_year']);
|
||||
}
|
||||
if (!empty($filters['semester'])) {
|
||||
if (! empty($filters['semester'])) {
|
||||
$query->where('semester', (string) $filters['semester']);
|
||||
}
|
||||
if (!empty($filters['q'])) {
|
||||
if (! empty($filters['q'])) {
|
||||
$term = trim((string) $filters['q']);
|
||||
$query->where('event_name', 'like', "%{$term}%");
|
||||
}
|
||||
@@ -67,10 +67,10 @@ class EventListService
|
||||
private function activeCount(array $filters): int
|
||||
{
|
||||
$query = Event::query()->whereDate('expiration_date', '>=', now()->toDateString());
|
||||
if (!empty($filters['school_year'])) {
|
||||
if (! empty($filters['school_year'])) {
|
||||
$query->where('school_year', (string) $filters['school_year']);
|
||||
}
|
||||
if (!empty($filters['semester'])) {
|
||||
if (! empty($filters['semester'])) {
|
||||
$query->where('semester', (string) $filters['semester']);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@ class EventManagementService
|
||||
public function __construct(
|
||||
private EventChargeService $charges,
|
||||
private InvoiceGenerationService $invoiceGeneration
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function create(array $payload, ?UploadedFile $flyer, int $actorId): array
|
||||
{
|
||||
@@ -54,7 +53,7 @@ class EventManagementService
|
||||
public function update(int $eventId, array $payload, ?UploadedFile $flyer): array
|
||||
{
|
||||
$event = Event::query()->find($eventId);
|
||||
if (!$event) {
|
||||
if (! $event) {
|
||||
return ['ok' => false, 'message' => 'Event not found.'];
|
||||
}
|
||||
|
||||
@@ -81,7 +80,7 @@ class EventManagementService
|
||||
public function delete(int $eventId, int $actorId): array
|
||||
{
|
||||
$event = Event::query()->find($eventId);
|
||||
if (!$event) {
|
||||
if (! $event) {
|
||||
return ['ok' => false, 'message' => 'Event not found.'];
|
||||
}
|
||||
|
||||
@@ -99,7 +98,7 @@ class EventManagementService
|
||||
|
||||
private function storeFlyer(?UploadedFile $file): ?string
|
||||
{
|
||||
if (!$file || !$file->isValid()) {
|
||||
if (! $file || ! $file->isValid()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -120,13 +119,13 @@ class EventManagementService
|
||||
}
|
||||
|
||||
$dir = public_path('uploads/event_flyers');
|
||||
if (!File::exists($dir)) {
|
||||
if (! File::exists($dir)) {
|
||||
File::makeDirectory($dir, 0755, true);
|
||||
}
|
||||
|
||||
$name = bin2hex(random_bytes(16)) . '.' . $allowed[$mime];
|
||||
$name = bin2hex(random_bytes(16)).'.'.$allowed[$mime];
|
||||
$file->move($dir, $name);
|
||||
|
||||
return 'event_flyers/' . $name;
|
||||
return 'event_flyers/'.$name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class EventStudentChargeService
|
||||
foreach ($students as $student) {
|
||||
$data[] = [
|
||||
'id' => (int) ($student['id'] ?? 0),
|
||||
'name' => trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? '')),
|
||||
'name' => trim(($student['firstname'] ?? '').' '.($student['lastname'] ?? '')),
|
||||
'charged' => isset($chargedMap[(int) ($student['id'] ?? 0)]),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user