Skip to content

Commit

Permalink
Remove dashboard route
Browse files Browse the repository at this point in the history
  • Loading branch information
techenby committed Apr 26, 2024
1 parent 1328191 commit ff7bfc1
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function store(LoginRequest $request): RedirectResponse

$request->session()->regenerate();

return redirect()->intended(route('dashboard', absolute: false));
return redirect()->intended(route('tricks.index', absolute: false));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ public function store(Request $request): RedirectResponse

$request->session()->put('auth.password_confirmed_at', time());

return redirect()->intended(route('dashboard', absolute: false));
return redirect()->intended(route('tricks.index', absolute: false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class EmailVerificationNotificationController extends Controller
public function store(Request $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false));
return redirect()->intended(route('tricks.index', absolute: false));
}

$request->user()->sendEmailVerificationNotification();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class EmailVerificationPromptController extends Controller
public function __invoke(Request $request): RedirectResponse|View
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(route('dashboard', absolute: false))
? redirect()->intended(route('tricks.index', absolute: false))
: view('auth.verify-email');
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/RegisteredUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public function store(Request $request): RedirectResponse

Auth::login($user);

return redirect(route('dashboard', absolute: false));
return redirect(route('tricks.index', absolute: false));
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/VerifyEmailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class VerifyEmailController extends Controller
public function __invoke(EmailVerificationRequest $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
return redirect()->intended(route('tricks.index', absolute: false) . '?verified=1');
}

if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}

return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
return redirect()->intended(route('tricks.index', absolute: false) . '?verified=1');
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/TrickController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function store(Request $request)

auth()->user()->tricks()->create($data);

return redirect()->route('dashboard');
return redirect()->route('tricks.index');
}

public function show(Trick $trick)
Expand Down Expand Up @@ -61,7 +61,7 @@ public function update(Request $request, Trick $trick)

$trick->update($data);

return redirect()->route('dashboard');
return redirect()->route('tricks.index');
}

public function destroy(Trick $trick)
Expand All @@ -70,6 +70,6 @@ public function destroy(Trick $trick)

$trick->delete();

return redirect()->route('dashboard');
return redirect()->route('tricks.index');
}
}
17 changes: 0 additions & 17 deletions resources/views/dashboard.blade.php

This file was deleted.

28 changes: 23 additions & 5 deletions resources/views/layouts/navigation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ route('dashboard') }}">
<a href="{{ route('tricks.index') }}">
<x-application-logo class="block h-9 w-auto fill-current text-gray-800 dark:text-gray-200" />
</a>
</div>

<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
<x-nav-link :href="route('tricks.index')" :active="request()->routeIs('tricks.index')">
{{ __('Browse') }}
</x-nav-link>
</div>
</div>
Expand Down Expand Up @@ -53,6 +53,16 @@
</x-dropdown>
</div>
@endauth
@guest
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('login')" :active="request()->routeIs('login')">
{{ __('Log In') }}
</x-nav-link>
<x-nav-link :href="route('register')" :active="request()->routeIs('register')">
{{ __('Register') }}
</x-nav-link>
</div>
@endguest

<!-- Hamburger -->
<div class="-me-2 flex items-center sm:hidden">
Expand All @@ -69,8 +79,8 @@
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
{{ __('Dashboard') }}
<x-responsive-nav-link :href="route('tricks.index')" :active="request()->routeIs('tricks.index')">
{{ __('Browse') }}
</x-responsive-nav-link>
</div>

Expand Down Expand Up @@ -100,5 +110,13 @@
</div>
</div>
@endauth
@guest
<x-responsive-nav-link :href="route('login')" :active="request()->routeIs('login')">
{{ __('Log In') }}
</x-responsive-nav-link>
<x-responsive-nav-link :href="route('register')" :active="request()->routeIs('register')">
{{ __('Register') }}
</x-responsive-nav-link>
@endguest
</div>
</nav>
172 changes: 0 additions & 172 deletions resources/views/welcome.blade.php

This file was deleted.

4 changes: 0 additions & 4 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

Route::get('/', [TrickController::class, 'index'])->name('tricks.index');

Route::get('dashboard', function () {
return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::middleware('auth')->group(function () {
Route::get('tricks/create', [TrickController::class, 'create'])->name('tricks.create');
Route::post('tricks', [TrickController::class, 'store'])->name('tricks.store');
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Auth/AuthenticationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
]);

$this->assertAuthenticated();
$response->assertRedirect(route('dashboard', absolute: false));
$response->assertRedirect(route('tricks.index', absolute: false));
});

test('users can not authenticate with invalid password', function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Auth/EmailVerificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

Event::assertDispatched(Verified::class);
expect($user->fresh()->hasVerifiedEmail())->toBeTrue();
$response->assertRedirect(route('dashboard', absolute: false) . '?verified=1');
$response->assertRedirect(route('tricks.index', absolute: false) . '?verified=1');
});

test('email is not verified with invalid hash', function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Auth/RegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
]);

$this->assertAuthenticated();
$response->assertRedirect(route('dashboard', absolute: false));
$response->assertRedirect(route('tricks.index', absolute: false));
});

0 comments on commit ff7bfc1

Please sign in to comment.