Commit 2564c9ef authored by Artem's avatar Artem

add profile page

parent 52f77418
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ProfileController extends Controller
{
public function index()
{
return view('profile.personal');
}
public function showOrders()
{
return view('profile.orders');
}
}
......@@ -18,7 +18,7 @@
</head>
<body>
<div id="app">
@include('layouts.header')
@include('partials.header')
<main class="main">
@yield('content')
......
@extends('layouts.app')
@section('content')
<section class="profile">
<div class="container">
<section class="row">
@include('partials.profile-nav')
<section class="col">
@yield('profile-content')
</section>
</div>
</div>
</section>
@endsection
@section('header')
<header class="header">
<nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
<div class="container">
......@@ -13,8 +12,8 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<span class="amount-in-cart badge badge-info text-white">{{ Session::has('cart') ? Session::get('cart')->total_qty : ''}}</span>
<li class="nav-item d-flex align-items-center">
<span class="amount-in-cart badge badge-info text-white mr-1">{{ Session::has('cart') ? Session::get('cart')->total_qty : ''}}</span>
<a href="{{ route('cart.index') }}">Shopping cart</a>
</li>
</ul>
......@@ -38,15 +37,25 @@
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }}
</a>
<a class="dropdown-item"
href="{{ route('profile.index') }}"
>My profile</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
<form id="logout-form" action="{{ route('logout') }}" method="POST"">
@csrf
<button class="dropdown-item">{{ __('Logout') }}</button>
</form>
{{-- <a class="dropdown-item" href="{{ route('logout') }}"--}}
{{-- onclick="event.preventDefault();--}}
{{-- document.getElementById('logout-form').submit();">--}}
{{-- {{ __('Logout') }}--}}
{{-- </a>--}}
{{-- <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">--}}
{{-- @csrf--}}
{{-- </form>--}}
</div>
</li>
@endguest
......
<nav class="col-2">
<ul class="nav flex-column nav-pills">
<li class="nav-item">
<a class="nav-link {{ Request::url() === route('profile.index') ? 'active' : '' }}"
href="{{ route('profile.index') }}"
>Personal information</a>
</li>
<li class="nav-item">
<a class="nav-link {{ Request::url() === route('profile.orders') ? 'active' : '' }}"
href="{{ route('profile.orders') }}"
>My orders</a>
</li>
</ul>
</nav>
@extends('layouts.profile')
@section('profile-content')
<h1>Orders coming soon</h1>
@endsection
@extends('layouts.profile')
@section('profile-content')
<h1>Pesronal info should be here, but it's not :(</h1>
@endsection
......@@ -36,7 +36,12 @@ Route::prefix('cart')->group(function() {
Route::post('/remove/{product}', 'CartController@removeFromCart')->name('cart.removeFromCart');
Route::post('/clear', 'CartController@clearCart')->name('cart.clearCart');
});
//
Route::middleware('auth')->prefix('profile')->group(function() {
Route::get('/', 'ProfileController@index')->name('profile.index');
Route::get('/personal', 'ProfileController@index')->name('profile.index');
Route::get('/orders', 'ProfileController@showOrders')->name('profile.orders');
});
Route::redirect('order', '/'); // TODO to ask if there is a way to show 404 and not use redirect
Route::post('order', 'OrderController@store')->name('order.sendOrder')->middleware('auth');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment