diff options
-rw-r--r-- | app/Http/Controllers/PagesController.php | 24 | ||||
-rw-r--r-- | app/Http/Controllers/SpecialCallsController.php | 2 | ||||
-rw-r--r-- | resources/views/pages/reserve.blade.php | 22 | ||||
-rw-r--r-- | resources/views/pages/services.blade.php | 13 |
4 files changed, 18 insertions, 43 deletions
diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index c30f923..ebd6b13 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -20,8 +20,10 @@ class PagesController extends Controller public function news(Request $request) { - $news = Post::all(); + $news = Post::orderBy('created_at', 'desc')->get(); + //$data = ['news' => $news]; + //return view('pages.news')->with($data); //return view('pages.news')->with('news', $news); return view('pages.news', compact('news')); } @@ -79,24 +81,4 @@ class PagesController extends Controller Auth::logout(); return Redirect::back(); } - - // NOTES - //public function services() - //{ - ////$title = 'Some title'; - ////return view('pages.index', compact('title')); - //$data = [ - //'title' => 'Services', - //'services' => ['Web design', 'Programming', 'SEO'] - //]; - //return view('pages.services')->with($data); - //} - - //public function about() - //{ - ////$title = 'About'; - ////return view('pages.index')->with('title', $title); - //$data = ['title' => 'About']; - //return view('pages.index')->with($data); - //} } diff --git a/app/Http/Controllers/SpecialCallsController.php b/app/Http/Controllers/SpecialCallsController.php index 3a3ab89..dcfbbf0 100644 --- a/app/Http/Controllers/SpecialCallsController.php +++ b/app/Http/Controllers/SpecialCallsController.php @@ -38,6 +38,6 @@ class SpecialCallsController extends Controller 'phone' => ['required', 'regex:/^[0-9 ]+$/'], ]); - return redirect('reserve')->with('status', 'Reservation submitted.'); + return redirect()->route('reserve')->with('status', 'Reservation submitted.'); } } diff --git a/resources/views/pages/reserve.blade.php b/resources/views/pages/reserve.blade.php index fad6edc..fcb8fd4 100644 --- a/resources/views/pages/reserve.blade.php +++ b/resources/views/pages/reserve.blade.php @@ -10,6 +10,11 @@ {{ session('status') }} </div> @endif + @if ($errors->any()) + <div class="alert alert-danger"> + All fields must be filled! + </div> + @endif <form action="{{ route('reserve') }}" method="POST"> @csrf <!-- SPECIAL CALL --> @@ -26,7 +31,7 @@ <!-- START TIME --> <div class="form-group"> <label for="start-date">Start date:</label> - <input class="form-control @error('sdate') is-invalid @enderror" type="date" id="start-date" name="sdate" required> + <input class="form-control @error('sdate') is-invalid @enderror" type="date" id="start-date" name="sdate" value="{{ old('sdate') }}" required> @error('sdate') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror @@ -34,7 +39,7 @@ <div class="form-group"> <label for="start-time">Start time:</label> - <input class="form-control @error('stime') is-invalid @enderror" type="time" id="start-time" name="stime" required> + <input class="form-control @error('stime') is-invalid @enderror" type="time" id="start-time" name="stime" value="{{ old('stime') }}" required> @error('stime') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror @@ -43,7 +48,7 @@ <!-- END TIME --> <div class="form-group"> <label for="end-date">End date:</label> - <input class="form-control @error('edate') is-invalid @enderror" type="date" id="end-date" name="edate" required> + <input class="form-control @error('edate') is-invalid @enderror" type="date" id="end-date" name="edate" value="{{ old('edate') }}" required> @error('edate') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror @@ -51,7 +56,7 @@ <div class="form-group"> <label for="end-time">End time:</label> - <input class="form-control @error('etime') is-invalid @enderror" type="time" id="end-time" name="etime" required> + <input class="form-control @error('etime') is-invalid @enderror" type="time" id="end-time" name="etime" value="{{ old('etime') }}" required> @error('etime') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror @@ -134,6 +139,7 @@ <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror </fieldset> + <!-- MODES --> <fieldset class="form-group"> <legend>I will use modes:</legend> @@ -181,7 +187,7 @@ <!-- OPERATOR CALL --> <div class="form-group"> <label for="operator-call">Operator Callsign:</label> - <input class="form-control @error('ocall') is-invalid @enderror" type="text" id="operator-call" name="ocall" required> + <input class="form-control @error('ocall') is-invalid @enderror" type="text" id="operator-call" name="ocall" value="{{ old('ocall') }}" required> @error('ocall') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror @@ -190,7 +196,7 @@ <!-- OPERATOR NAME --> <div class="form-group"> <label for="operator-name">Operator name:</label> - <input class="form-control @error('oname') is-invalid @enderror" type="text" id="operator-name" name="oname" required> + <input class="form-control @error('oname') is-invalid @enderror" type="text" id="operator-name" name="oname" value="{{ old('oname') }}" required> @error('oname') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror @@ -199,7 +205,7 @@ <!-- OPERATOR EMAIL --> <div class="form-group"> <label for="operator-email">Operator email:</label> - <input class="form-control @error('email') is-invalid @enderror" type="email" id="operator-email" name="email" required> + <input class="form-control @error('email') is-invalid @enderror" type="email" id="operator-email" name="email" value="{{ old('email') }}" required> @error('email') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror @@ -208,7 +214,7 @@ <!-- OPERATOR PHONE --> <div class="form-group"> <label for="operator-phone">Operator phone:</label> - <input class="form-control @error('phone') is-invalid @enderror" type="tel" id="operator-phone" name="phone" required> + <input class="form-control @error('phone') is-invalid @enderror" type="tel" id="operator-phone" name="phone" value="{{ old('phone') }}" required> @error('phone') <div class="alert alert-danger mt-2">{{ $message }}</div> @enderror diff --git a/resources/views/pages/services.blade.php b/resources/views/pages/services.blade.php deleted file mode 100644 index 3654510..0000000 --- a/resources/views/pages/services.blade.php +++ /dev/null @@ -1,13 +0,0 @@ -@extends('layouts.app') - -@section('content') - <h1>{{ $title ?? 'Index'}}</h1> - <p>Something...</p> - @if(count($services) > 0) - <ul class="list-group"> - @foreach($services as $service) - <li class="list-group-item">{{$service}}</li> - @endforeach - </ul> - @endif -@endsection |