Commit c421b1d2 by Florian Shllaku

Contact page completedgit add .

parent c070eb2f
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Model;
class Admin extends Model
{
use Notifiable;
protected $admin;
protected $email;
public function __construct() {
$this->admin = config('admin.name');
$this->email = config('admin.email');
}
}
?>
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Mail\SendMail;
class SendEmailController extends Controller
{
//
function index()
{
return view('contact');
}
function send(Request $request)
{
$this->validate($request, [
'name' => 'required',
'email' => 'required|email',
'message' => 'required'
]);
$data = array(
'name' => $request->name,
'message' => $request->message,
);
Mail::to('garlix00@gmail.com')->send(new SendMail($data));
return back()->with('success', 'Thanks for contacting us!');
}
}
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class SendMail extends Mailable
{
use Queueable, SerializesModels;
public $data;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data)
{
$this->data = $data;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->from('garlix00@gmail.com')->subject('Costumer INQUIRY')->view('emailtext')->with('data', $this->data);
}
}
...@@ -29,7 +29,7 @@ return [ ...@@ -29,7 +29,7 @@ return [
| |
*/ */
'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'host' => env('MAIL_HOST', 'smtp.gunmail.org'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
...@@ -56,8 +56,8 @@ return [ ...@@ -56,8 +56,8 @@ return [
*/ */
'from' => [ 'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 'address' => env('MAIL_FROM_ADDRESS', 'garlix00@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Example'), 'name' => env('MAIL_FROM_NAME', null),
], ],
/* /*
...@@ -84,9 +84,9 @@ return [ ...@@ -84,9 +84,9 @@ return [
| |
*/ */
'username' => env('MAIL_USERNAME'), 'username' => "garlix00@gmail.com",
'password' => env('MAIL_PASSWORD'), 'password' => 'garlix12345!@#$%',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
......
...@@ -5,22 +5,45 @@ ...@@ -5,22 +5,45 @@
<div class="wrapper wrapper--w780"> <div class="wrapper wrapper--w780">
<div class="card card-3"> <div class="card card-3">
<div class="card-heading"></div> <div class="card-heading"></div>
@if(session('message'))
<div class='alert alert-success'>
{{ session('message') }}
</div>
@endif
<div class="card-body"> <div class="card-body">
<h2 class="title">Contact Us</h2> <h2 class="title">Contact Us</h2>
<br> <br>
<p id="contact-left">Get in-touch with us.</p> <p id="contact-left">Get in-touch with us.</p>
<form id="form" class="topBefore" action="" method="post"> @if(count($errors) > 0)
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@if($message = Session::get('success'))
<div class="alert alert-success alert-block">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>{{ $message }}</strong>
</div>
@endif
<form id="form" class="topBefore" action="{{ url('contact/send')}}" method="POST">
{{ csrf_field() }}
<div class="input-group"> <div class="input-group">
<input type="text" name="name" placeholder="NAME"> <input type="text" name="name" placeholder="NAME">
</div> </div>
<div class="input-group"> <div class="input-group">
<input type="email" name="email" placeholder="E-MAIL"> <input type="text" name="email" placeholder="E-MAIL">
</div> </div>
<div class="input-group"> <div class="input-group">
<textarea type="text" name="message" placeholder="MESSAGE"></textarea> <textarea type="text" name="message" placeholder="MESSAGE"></textarea>
</div> </div>
<div class="input-group"> <div class="input-group">
<input id="submit" type="submit" value="Submit"> <input id="submit" type="submit" name="send" value="Submit">
</div> </div>
</form> </form>
...@@ -29,4 +52,5 @@ ...@@ -29,4 +52,5 @@
</div> </div>
</div> </div>
@include('footer') @include('footer')
@endsection @endsection
\ No newline at end of file
<p>Hi, This is {{ $data['name'] }}!</p>
<p>Message: {{ $data['message'] }}.</p>
<p>Email address of the user: {{ $data['email'] }}.</p>
\ No newline at end of file
...@@ -9,11 +9,12 @@ ...@@ -9,11 +9,12 @@
<!-- Connecting with Google Material for websit's logo/icon autorenew--> <!-- Connecting with Google Material for websit's logo/icon autorenew-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- Setting up BootstrapCDN --> <!-- Setting up BootstrapCDN -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<!-- Main Custom styles for the website --> <!-- Main Custom styles for the website -->
<link href="css\main.css" rel="stylesheet"> <link href="css\main.css" rel="stylesheet">
@if(\Request::is('contact')) <link href="css\contact.css" rel="stylesheet"> @endif @if(\Request::is('contact')) <link href="css\contact.css" rel="stylesheet"> @endif
@if(\Request::is('crypto'))<link href="css\crypto.css" rel="stylesheet"> @endif @if(\Request::is('crypto'))<link href="css\crypto.css" rel="stylesheet"> @endif
@if(\Request::is('subscribe')) <link href="css\subscribe.css" rel="stylesheet"> @endif @if(\Request::is('subscribe')) <link href="css\subscribe.css" rel="stylesheet"> @endif
</head> </head>
......
...@@ -31,3 +31,7 @@ Route::get('/crypto', function () { ...@@ -31,3 +31,7 @@ Route::get('/crypto', function () {
return view('crypto'); return view('crypto');
}); });
Route::get('/contact', 'SendEmailController@index');
Route::post('/contact/send', 'SendEmailController@send');
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 sign in to comment