-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c560ba0
commit c38b1cb
Showing
13 changed files
with
347 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# contact | ||
AvoRed E commerce Contact Module | ||
# AvoRed E commerce Dummy Data | ||
|
||
AvoRed E commerce Dummy Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "avored/contact", | ||
"type": "avored-module", | ||
"description": "AvoRed Laravel 5 E commerce Contact Module", | ||
"keywords": ["framework", "contact" ,"cart","laravel","e commerce","laravel5","shop","shopping-cart","e-commerce","shopping cart","e commerce"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Purvesh ", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "dev", | ||
"require": { | ||
"php": ">=7.0.0", | ||
"avored/module-installer": "dev-master" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"AvoRed\\Contact\\": "src" | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
identifier: avored-contact | ||
description: AvoRed Contact Module | ||
namespace: AvoRed\Contact\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
<?php | ||
|
||
|
||
return [ | ||
|
||
|
||
|
||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@extends('layouts.app') | ||
|
||
@section('meta_title') | ||
Contact US | ||
@endsection | ||
|
||
@section('content') | ||
<div class="row"> | ||
|
||
<div class="col-md-12"> | ||
|
||
<h1>Contact US</h1> | ||
<div class=""> | ||
<form action="{{ route('contact.send') }}" method="post"> | ||
@csrf | ||
|
||
@include('partials.forms.text',['name' => 'name','label' => 'Name']) | ||
@include('partials.forms.text',['name' => 'email','label' => 'Email']) | ||
@include('partials.forms.text',['name' => 'phone','label' => 'Phone']) | ||
|
||
<div class="form-group"> | ||
<label for="message">Message</label> | ||
<textarea class="form-control{{ $errors->has('message') ? " is-invalid" : "" }}" name="message" id="messge"></textarea> | ||
|
||
@if($errors->has('message')) | ||
<div class="invalid-feedback"> | ||
{{ $errors->first('message') }} | ||
</div> | ||
@endif | ||
</div> | ||
|
||
<button type="submit" class="btn btn-primary" >Send</button> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@component('mail::message') | ||
|
||
|
||
@component('mail::panel') | ||
# Contact Message Received | ||
|
||
You received this email as an acknoledgement because you send an inquiry thorough AvoRed Contact us form. | ||
We are happy to tell you that we have received your email and we will be in touch soon. | ||
@endcomponent | ||
|
||
Thanks, | ||
AvoRed | ||
@endcomponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@component('mail::message') | ||
|
||
# Contact Message Received | ||
|
||
Name: {{ $name }} | ||
Email: {{ $email }} | ||
Phone: {{ $phone }} | ||
Message: {{ $message }} | ||
|
||
Thanks | ||
@endcomponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| AvoRed E commerce Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register all of the routes for an avored user modules. | ||
| It's a breeze. Simply tell avored user module the URI it should respond to | ||
| and give it the controller to call when that URI is requested. | ||
| | ||
*/ | ||
|
||
|
||
Route::middleware(['web']) | ||
->namespace('AvoRed\Contact\Http\Controllers') | ||
->group(function () { | ||
Route::get('contact', 'ContactController@index')->name('contact.index'); | ||
|
||
Route::post('contact', 'ContactController@send')->name('contact.send'); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace AvoRed\Contact\Http\Controllers; | ||
|
||
use AvoRed\Contact\Http\Requests\ContactRequest; | ||
use AvoRed\Ecommerce\Models\Database\Configuration; | ||
use Illuminate\Http\Request; | ||
use App\Http\Controllers\Controller; | ||
use AvoRed\Contact\Mails\ContactMail; | ||
use AvoRed\Contact\Mails\ContactMailRequest; | ||
use Illuminate\Support\Facades\Mail; | ||
|
||
class ContactController extends Controller | ||
{ | ||
public function index() { | ||
return view('avored-contact::contact.index'); | ||
} | ||
|
||
public function send(ContactRequest $request) { | ||
//return $request->all(); | ||
|
||
$configuration = new Configuration(); | ||
$adminEmail = $configuration->getConfiguration('general_administrator_email'); | ||
|
||
// Sent an EMail to AvoRed Administrator | ||
Mail::to($adminEmail)->send(new ContactMailRequest($request)); | ||
|
||
// Sent an EMail to AvoRed Administrator | ||
Mail::to($request->get('email'))->send(new ContactMail()); | ||
|
||
|
||
return redirect()->route('contact.index')->with('successNotification', 'Your Request has been sent!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace AvoRed\Contact\Http\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest as Request; | ||
|
||
class ContactRequest extends Request | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize() | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
$validation['name'] = 'required|max:255'; | ||
$validation['email'] = 'required|email|max:255'; | ||
$validation['phone'] = 'required|min:6'; | ||
$validation['message'] = 'required|min:6'; | ||
|
||
return $validation; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace AvoRed\Contact\Mails; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class ContactMail extends Mailable | ||
{ | ||
use Queueable, SerializesModels; | ||
|
||
|
||
|
||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
return $this->markdown('avored-contact::mails.contact-acknoledgement'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace AvoRed\Contact\Mails; | ||
|
||
use AvoRed\Contact\Http\Requests\ContactRequest; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class ContactMailRequest extends Mailable | ||
{ | ||
use Queueable, SerializesModels; | ||
|
||
/** | ||
* @var $name | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* @var $phone | ||
*/ | ||
public $phone; | ||
|
||
/** | ||
* @var $email | ||
*/ | ||
public $email; | ||
|
||
/** | ||
* @var $message | ||
*/ | ||
public $message; | ||
|
||
/** | ||
* Create a new message instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(ContactRequest $request) | ||
{ | ||
$this->name = $request->get('name'); | ||
$this->phone = $request->get('phone'); | ||
$this->email = $request->get('email'); | ||
$this->message = $request->get('message'); | ||
|
||
} | ||
|
||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
return $this->replyTo($this->email, $this->name) | ||
->markdown("avored-contact::mails.contact-request"); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
namespace AvoRed\Contact; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use AvoRed\Framework\Menu\Menu; | ||
use AvoRed\Framework\Menu\Facade as MenuFacade; | ||
|
||
class Module extends ServiceProvider | ||
{ | ||
|
||
/** | ||
* Bootstrap any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
$this->registerResources(); | ||
$this->registerFrontMenu(); | ||
$this->publishFiles(); | ||
|
||
} | ||
|
||
/** | ||
* Register any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Registering AvoRed Contact Resource | ||
* e.g. Route, View, Database & Translation Path | ||
* | ||
* @return void | ||
*/ | ||
protected function registerResources() | ||
{ | ||
$this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); | ||
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'avored-contact'); | ||
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'avored-contact'); | ||
} | ||
|
||
/** | ||
* Register the Publish Files | ||
* | ||
* @return void | ||
*/ | ||
public function publishFiles() | ||
{ | ||
$this->publishes([ | ||
__DIR__ . '/../resources/views' => base_path('themes/avored/default/views/vendor') | ||
],'avored-module-views'); | ||
} | ||
|
||
/** | ||
* Register the Menus. | ||
* | ||
* @return void | ||
*/ | ||
protected function registerFrontMenu() | ||
{ | ||
MenuFacade::make('contact-us',function (Menu $accountMenu){ | ||
$accountMenu->label('Contact Us') | ||
->route('contact.index'); | ||
}); | ||
|
||
} | ||
} |