mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-23 20:10:52 +00:00
Including messages on registering and invalid product
This commit is contained in:
parent
02f303825e
commit
aebffe304f
@ -72,6 +72,8 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
\Mail::to($user)->send(new Welcome($user));
|
\Mail::to($user)->send(new Welcome($user));
|
||||||
|
|
||||||
|
session()->flash('primary', 'Thanks for registering. Please, do not forget to validate your e-mail address.');
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ class ProductController extends Controller
|
|||||||
$product->name = request('name');
|
$product->name = request('name');
|
||||||
$product->url = request('url');
|
$product->url = request('url');
|
||||||
$product->save();
|
$product->save();
|
||||||
return redirect('product/'.request('product'));
|
return redirect('product/' . request('product'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,8 +70,8 @@ class ProductController extends Controller
|
|||||||
$product = Product::fromAuthUser()->find($id);
|
$product = Product::fromAuthUser()->find($id);
|
||||||
|
|
||||||
if (!$product) {
|
if (!$product) {
|
||||||
|
session()->flash('danger', "The product doesn't exist or doesn't belongs to you.");
|
||||||
return back();
|
return back();
|
||||||
|
|
||||||
}
|
}
|
||||||
return view('product.show', compact('product'));
|
return view('product.show', compact('product'));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
@ -19,6 +20,7 @@
|
|||||||
<!-- Styles -->
|
<!-- Styles -->
|
||||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<nav class="navbar navbar-expand-md navbar-light navbar-laravel">
|
<nav class="navbar navbar-expand-md navbar-light navbar-laravel">
|
||||||
@ -26,7 +28,8 @@
|
|||||||
<a class="navbar-brand" href="{{ url('/') }}">
|
<a class="navbar-brand" href="{{ url('/') }}">
|
||||||
{{ config('app.name', 'Laravel') }}
|
{{ config('app.name', 'Laravel') }}
|
||||||
</a>
|
</a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
|
||||||
|
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@ -40,39 +43,47 @@
|
|||||||
<ul class="navbar-nav ml-auto">
|
<ul class="navbar-nav ml-auto">
|
||||||
<!-- Authentication Links -->
|
<!-- Authentication Links -->
|
||||||
@guest
|
@guest
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
|
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
|
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
|
||||||
</li>
|
</li>
|
||||||
@else
|
@else
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
|
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown"
|
||||||
{{ Auth::user()->name }} <span class="caret"></span>
|
aria-haspopup="true" aria-expanded="false" v-pre>
|
||||||
|
{{ Auth::user()->name }} <span class="caret"></span>
|
||||||
|
</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>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
|
||||||
<a class="dropdown-item" href="{{ route('logout') }}"
|
@csrf
|
||||||
onclick="event.preventDefault();
|
</form>
|
||||||
document.getElementById('logout-form').submit();">
|
</div>
|
||||||
{{ __('Logout') }}
|
</li>
|
||||||
</a>
|
|
||||||
|
|
||||||
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
|
|
||||||
@csrf
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
@endguest
|
@endguest
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
@if ($flashMsg = session('primary'))
|
||||||
|
<div class="alert alert-primary text-center" role="alert">{{ $flashMsg }}</div>
|
||||||
|
@endif
|
||||||
|
@if ($flashMsg = session('danger'))
|
||||||
|
<div class="alert alert-danger text-center" role="alert">{{ $flashMsg }}</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<main class="py-4">
|
<main class="py-4">
|
||||||
@yield('content')
|
@yield('content')
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user