Skip to content

Commit

Permalink
will come back to events shorlty
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Aug 17, 2024
1 parent dea5b44 commit 5541eda
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions app/Http/Controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Models\Collection;
use App\Models\Event;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Inertia\Inertia;

Expand All @@ -18,7 +17,7 @@ public function index(Collection $collection)
$startMonth = now()->startOfMonth();
$endMonth = now()->endOfMonth();

if(request()->has('start')) {
if (request()->has('start')) {
$startMonth = Carbon::parse(request()->get('start'));
$endMonth = Carbon::parse(request()->get('end'));
}
Expand Down
2 changes: 0 additions & 2 deletions app/Http/Resources/EventResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Http\Resources;

use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

Expand All @@ -16,7 +15,6 @@ class EventResource extends JsonResource
public function toArray(Request $request): array
{


return [
'id' => $this->id,
'title' => $this->title,
Expand Down
3 changes: 1 addition & 2 deletions app/Models/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getEndAttribute()

private function formatDateTime($date, $time)
{
if (!$date) {
if (! $date) {
return null;
}

Expand All @@ -58,7 +58,6 @@ private function formatDateTime($date, $time)
$dateTime->setTimeFromTimeString($formattedTime);
}


return $dateTime->toIso8601String();
}
}
1 change: 0 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function () {
}
);


Route::controller(\App\Http\Controllers\EventsController::class)->group(
function () {
Route::get('/collections/{collection}/events', 'index')
Expand Down
5 changes: 1 addition & 4 deletions tests/Feature/Http/Controllers/EventsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use App\Models\Collection;
use App\Models\Event;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;

class EventsControllerTest extends TestCase
Expand All @@ -26,7 +23,7 @@ public function test_events(): void
]);

$this->actingAs($user)->get(route('collections.events.index', $collection))
->assertOk();
->assertOk();

}
}

0 comments on commit 5541eda

Please sign in to comment.