Skip to content

Commit 76f5a1a

Browse files
Finnick223github-actions[bot]
authored andcommitted
PHP Linting (Pint)
1 parent c26b436 commit 76f5a1a

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

app/Http/Controllers/InstructorEventController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function store(StoreInstructorEventRequest $request)
4040
$event = $driver->events()->create([
4141
'title' => $validated['title'],
4242
'start' => $dateRange->start,
43-
'end' => $dateRange->end,
43+
'end' => $dateRange->end,
4444
]);
4545
$event->load('driver');
4646

@@ -57,7 +57,7 @@ public function update(UpdateInstructorEventRequest $request, Event $event)
5757
$event->update([
5858
'title' => $validated['title'],
5959
'start' => $validated['start'],
60-
'end' => $validated['end'],
60+
'end' => $validated['end'],
6161
]);
6262
$event->load('driver');
6363

@@ -70,7 +70,7 @@ public function update(UpdateInstructorEventRequest $request, Event $event)
7070
public function destroy(Request $request, Event $event)
7171
{
7272
$instructor = $request->user();
73-
if (!$instructor->drivers()->where('id', $event->user_id)->exists()) {
73+
if (! $instructor->drivers()->where('id', $event->user_id)->exists()) {
7474
return response()->json(['message' => 'Unauthorized event'], 403);
7575
}
7676

app/Http/Requests/StoreInstructorEventRequest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@ class StoreInstructorEventRequest extends FormRequest
1010
/**
1111
* Determine if the user is authorized to make this request.
1212
*/
13-
public function authorize(): bool {
13+
public function authorize(): bool
14+
{
1415
$driverId = $this->input('driver_id');
1516
$instructor = $this->user();
17+
1618
return $instructor && $instructor->drivers()->where('id', $driverId)->exists();
1719
}
18-
public function rules(): array {
20+
21+
public function rules(): array
22+
{
1923
return [
2024
'driver_id' => 'required|integer|exists:users,id',
21-
'title' => 'required|string|max:255',
22-
'start' => 'required|date',
23-
'end' => 'required|date|after:start',
25+
'title' => 'required|string|max:255',
26+
'start' => 'required|date',
27+
'end' => 'required|date|after:start',
2428
];
2529
}
2630

app/Models/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Event extends Model
1111

1212
protected $casts = [
1313
'start' => 'datetime',
14-
'end' => 'datetime',
14+
'end' => 'datetime',
1515
];
1616

1717
public function driver(): BelongsTo

app/ValueObjects/EventDateRange.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88
readonly class EventDateRange
99
{
1010
public DateTimeImmutable $start;
11+
1112
public DateTimeImmutable $end;
1213

1314
public function __construct(string $start, string $end)
1415
{
1516
$startDate = new DateTimeImmutable($start);
16-
$endDate = new DateTimeImmutable($end);
17+
$endDate = new DateTimeImmutable($end);
1718

1819
if ($endDate <= $startDate) {
1920
throw new InvalidArgumentException('The end date must be after the start date.');
2021
}
2122

2223
$this->start = $startDate;
23-
$this->end = $endDate;
24+
$this->end = $endDate;
2425
}
2526

2627
public static function fromArray(array $dates): self

0 commit comments

Comments
 (0)