aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Http/Controllers/PagesController.php55
-rw-r--r--database/factories/PostFactory.php2
-rw-r--r--resources/views/pages/index.blade.php2
-rw-r--r--resources/views/pages/login.blade.php4
-rw-r--r--resources/views/pages/reserve.blade.php18
5 files changed, 39 insertions, 42 deletions
diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php
index 3955254..5041f05 100644
--- a/app/Http/Controllers/PagesController.php
+++ b/app/Http/Controllers/PagesController.php
@@ -7,6 +7,9 @@ use App\Models\Post;
use function dd;
use function redirect;
+use Illuminate\Support\Facades\Validator;
+use Illuminate\Support\Facades\Redirect;
+
class PagesController extends Controller
{
public function index(Request $request)
@@ -19,8 +22,6 @@ class PagesController extends Controller
return view('pages.sponsoring');
}
- //--------------------------------------
-
public function news(Request $request)
{
$news = Post::all();
@@ -51,8 +52,6 @@ class PagesController extends Controller
public function reserveForm(Request $request)
{
- //dd($request->input('modes'));
-
$validatedData = $request->validate([
'scall' => 'required|alphanum',
'sdate' => 'required|date',
@@ -67,38 +66,36 @@ class PagesController extends Controller
'phone' => ['required', 'regex:/^[0-9 ]+$/'],
]);
-/*
- $table->id();
- $table->boolean('approved')->default(false);
- $table->unsignedBigInteger('specialCall');
- $table->dateTime('fromTime');
- $table->dateTime('toTime');
- $table->string('frequencies', 255);
- $table->string('modes', 255);
- $table->string('operatorCall');
- $table->string('operatorName');
- $table->string('operatorEmail');
- $table->string('operatorPhone', 50);
- $table->integer('qso')->default(0);
- $table->timestamps();
- $table->foreign('specialCall')->references('id')->on('special_calls');
-*/
-
return redirect('reserve')->with('status', 'Reservation submitted.');
}
- /**
- * undocumented function
- *
- * @return void
- */
public function loginForm(Request $request)
{
- $validatedData = $request->validate([
+ $rules = [
'email' => 'required|email',
'password' => 'required',
- ]);
- return redirect('login')->with('status', 'Submitted.');
+ ];
+
+ $messages = [
+ 'email.required' => 'Your email address is required.',
+ 'password.required' => 'Your password is required.',
+ ];
+
+ $validator = Validator::make($request->all(), $rules, $messages);
+
+ if ($validator->fails()) {
+ //return redirect('login')
+ return Redirect::back()
+ ->withErrors($validator)
+ ->withInput();
+ }
+
+ //$validatedData = $request->validate([
+ //'email' => 'required|email',
+ //'password' => 'required',
+ //]);
+ //return redirect('login')->with('status', 'Submitted.');
+ return Redirect::back()->with('status', 'Submitted.');
}
diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.php
index 0b00530..ea950a1 100644
--- a/database/factories/PostFactory.php
+++ b/database/factories/PostFactory.php
@@ -22,7 +22,7 @@ class PostFactory extends Factory
public function definition()
{
return [
- 'title' => $this->faker->title,
+ 'title' => $this->faker->word,
'author' => $this->faker->name,
'text' => $this->faker->text,
];
diff --git a/resources/views/pages/index.blade.php b/resources/views/pages/index.blade.php
index 1b7974f..eed53ac 100644
--- a/resources/views/pages/index.blade.php
+++ b/resources/views/pages/index.blade.php
@@ -39,7 +39,7 @@ It is consisted of the management building,
3 groups of bungalows,
auxiliary facilities,
sports courts and the following contents.
-“Čardak“is surrounded by paths which are marked by information boards,
+“Čardak“ is surrounded by paths which are marked by information boards,
resting places and viewpoints.
It provides a complete stay in the nature for school children,
university students and especially experts in biological sciences.
diff --git a/resources/views/pages/login.blade.php b/resources/views/pages/login.blade.php
index bb1b7c8..b323872 100644
--- a/resources/views/pages/login.blade.php
+++ b/resources/views/pages/login.blade.php
@@ -10,14 +10,14 @@
@csrf
<div class="form-group">
<label for="email">Email: </label>
- <input class="form-control @error('email') is-invalid @enderror" type="email" id="email" name="email" value="{{ old('email') }}">
+ <input class="form-control @error('email') is-invalid @enderror" type="email" id="email" name="email" value="{{ old('email') }}" required>
@error('email')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
</div>
<div class="form-group">
<label for="pw">Password: </label>
- <input class="form-control @error('password') is-invalid @enderror" type="password" id="pw" name="password">
+ <input class="form-control @error('password') is-invalid @enderror" type="password" id="pw" name="password" required>
@error('password')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
diff --git a/resources/views/pages/reserve.blade.php b/resources/views/pages/reserve.blade.php
index 26003b8..163fea0 100644
--- a/resources/views/pages/reserve.blade.php
+++ b/resources/views/pages/reserve.blade.php
@@ -11,7 +11,7 @@
<!-- SPECIAL CALL -->
<div class="form-group">
<label for="special-call">Special Callsign:</label>
- <select class="form-control @error('scall') is-invalid @enderror" id="special-call" name="scall">
+ <select class="form-control @error('scall') is-invalid @enderror" id="special-call" name="scall" required>
<option value="YT50SCWC">YT50SCWC</option>
</select>
@error('scall')
@@ -22,7 +22,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">
+ <input class="form-control @error('sdate') is-invalid @enderror" type="date" id="start-date" name="sdate" required>
@error('sdate')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
@@ -30,7 +30,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">
+ <input class="form-control @error('stime') is-invalid @enderror" type="time" id="start-time" name="stime" required>
@error('stime')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
@@ -39,7 +39,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">
+ <input class="form-control @error('edate') is-invalid @enderror" type="date" id="end-date" name="edate" required>
@error('edate')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
@@ -47,7 +47,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">
+ <input class="form-control @error('etime') is-invalid @enderror" type="time" id="end-time" name="etime" required>
@error('etime')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
@@ -177,7 +177,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">
+ <input class="form-control @error('ocall') is-invalid @enderror" type="text" id="operator-call" name="ocall" required>
@error('ocall')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
@@ -186,7 +186,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">
+ <input class="form-control @error('oname') is-invalid @enderror" type="text" id="operator-name" name="oname" required>
@error('oname')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
@@ -195,7 +195,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">
+ <input class="form-control @error('email') is-invalid @enderror" type="email" id="operator-email" name="email" required>
@error('email')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror
@@ -204,7 +204,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">
+ <input class="form-control @error('phone') is-invalid @enderror" type="tel" id="operator-phone" name="phone" required>
@error('phone')
<div class="alert alert-danger mt-2">{{ $message }}</div>
@enderror