Skip to content

Commit

Permalink
Add showing tricks
Browse files Browse the repository at this point in the history
  • Loading branch information
techenby committed Apr 25, 2024
1 parent 9084b54 commit a319f07
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Http/Controllers/TrickController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public function store(Request $request)

public function show(Trick $trick)
{
//
return view('tricks.show', [
'trick' => $trick,
]);
}

public function edit(Trick $trick)
Expand Down
13 changes: 13 additions & 0 deletions resources/views/tricks/show.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ $trick->name }}
</h2>
</x-slot>

<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">

</div>
</div>
</x-app-layout>
2 changes: 2 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
Route::delete('profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

Route::get('tricks/{trick}', [TrickController::class, 'show'])->name('tricks.show');

require __DIR__ . '/auth.php';
7 changes: 7 additions & 0 deletions tests/Feature/TrickTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
});

// Show
test('can view trick', function () {
$trick = Trick::factory()->create(['name' => 'How to make a trick']);

$this->get(route('tricks.show', $trick))
->assertStatus(200)
->assertSee('How to make a trick');
});

// Edit
test('can view edit trick page', function () {
Expand Down

0 comments on commit a319f07

Please sign in to comment.