Skip to content

Commit

Permalink
Enhance navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
iambasanta committed Jun 8, 2023
1 parent 62a614d commit e697046
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 34 deletions.
3 changes: 2 additions & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
public const HOME = '/dashboard';
public const HOME = '/';
public const ADMIN_HOME = '/admin';

/**
* Define your route model bindings, pattern filters, and other route configuration.
Expand Down
83 changes: 72 additions & 11 deletions resources/views/components/frontend/nav.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,38 @@
</div>

<div class="space-y-6 border-t border-gray-200 px-4 py-6">
<div class="flow-root">
<a href="#" class="-m-2 block p-2 font-medium text-gray-900">Create an account</a>
</div>
<div class="flow-root">
<a href="#" class="-m-2 block p-2 font-medium text-gray-900">Sign in</a>
</div>
@auth
<div class="pt-4 pb-1 ">
<div class="px-4">
<div class="font-medium text-base text-gray-800">{{ Auth::user()->name }}</div>
<div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
</div>

<div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile.edit')">
{{ __('Profile') }}
</x-responsive-nav-link>

<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf

<x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-responsive-nav-link>
</form>
</div>
</div>
@else
<div class="flow-root">
<a href="{{ route('register') }}" class="-m-2 block p-2 font-medium text-gray-900">Create an account</a>
</div>
<div class="flow-root">
<a href="{{ route('login') }}" class="-m-2 block p-2 font-medium text-gray-900">Sign in</a>
</div>
@endauth
</div>

</div>
Expand Down Expand Up @@ -225,11 +251,46 @@
</div>

<div class="flex items-center lg:ml-8">
<div class="hidden lg:flex lg:flex-1 lg:items-center lg:justify-end lg:space-x-6">
<a href="#" class="text-sm font-medium text-gray-700 hover:text-gray-800">Sign in</a>
<span class="h-6 w-px bg-gray-200" aria-hidden="true"></span>
<a href="#" class="text-sm font-medium text-gray-700 hover:text-gray-800">Create account</a>
</div>
@auth
<div class="hidden sm:flex sm:items-center sm:ml-6">
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150">
<div>{{ Auth::user()->name }}</div>

<div class="ml-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</div>
</button>
</x-slot>

<x-slot name="content">
<x-dropdown-link :href="route('profile.edit')">
{{ __('Profile') }}
</x-dropdown-link>

<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf

<x-dropdown-link :href="route('logout')"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Log Out') }}
</x-dropdown-link>
</form>
</x-slot>
</x-dropdown>
</div>
@else
<div class="hidden lg:flex lg:flex-1 lg:items-center lg:justify-end lg:space-x-6">
<a href="{{ route('login') }}" class="text-sm font-medium text-gray-700 hover:text-gray-800">Sign in</a>
<span class="h-6 w-px bg-gray-200" aria-hidden="true"></span>
<a href="{{ route('register') }}" class="text-sm font-medium text-gray-700 hover:text-gray-800">Create account</a>
</div>
@endauth

<!-- Cart -->
<div class="ml-4 flow-root lg:ml-8">
Expand Down
17 changes: 0 additions & 17 deletions resources/views/dashboard.blade.php

This file was deleted.

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

Route::get('checkout', [CheckoutController::class, 'index'])->name('checkout.index');

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

Route::middleware('auth')->group(function () {
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Expand All @@ -51,7 +47,6 @@
Route::get('checkout/failure', [CheckoutController::class, 'failure'])->name('checkout.failure');
});


Route::group(['prefix' => 'admin', 'as' => 'admin.'], function () {
Route::group(['middleware' => ['auth']], function () {
Route::get('/', [HomeController::class, 'index'])->name('home');
Expand Down

0 comments on commit e697046

Please sign in to comment.