Skip to content

Commit

Permalink
add some validatio rules
Browse files Browse the repository at this point in the history
  • Loading branch information
plusemon committed May 24, 2022
1 parent 5941c46 commit b69cd9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/contact/src/http/controllers/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public function contact()

public function send(Request $request)
{
$request->validate([
'name' => ['required', 'string'],
'name' => ['required', 'email'],
'email' => ['required'],
]);

$save =
MailHistory::query()->create([
Expand Down
8 changes: 4 additions & 4 deletions packages/contact/src/views/contact.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
<body>

<form action="contact" method="POST" class="d-flex flex-column m-auto mt-3 w-50 gap-2 border p-3">
<h1 class="text-center">Contact with us</h1>
<input type="text" class="form-control" name="name" placeholder="enter your name">
<input type="email" class="form-control" name="email" placeholder="enter your email">
<textarea name="message" cols="30" rows="5" class="form-control"></textarea>
<h2 class="text-center">Contact with us</h2>
<input required type="text" class="form-control" name="name" placeholder="enter your name">
<input required type="email" class="form-control" name="email" placeholder="enter your email">
<textarea required name="message" cols="30" rows="5" class="form-control"></textarea>
<button type="submit" class="btn btn-primary">Send</button>
</form>
<br>
Expand Down

0 comments on commit b69cd9f

Please sign in to comment.