Skip to content

Commit

Permalink
Merge pull request #184 from avored/dev
Browse files Browse the repository at this point in the history
merging dev to master
  • Loading branch information
indpurvesh authored Aug 9, 2018
2 parents 3ea5b21 + 8e92268 commit 567ccca
Show file tree
Hide file tree
Showing 79 changed files with 865 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@ yarn-error.log
.env

# AvoRed Specific
storage/framework/bootstrap/cache/services.php
/packages
/themes/*
/public/cov/*

# Include Default Theme
!/themes/avored
/themes/avored/*
!/themes/avored/default

# Etc
composer.lock
public/mix-manifest.json
Expand Down
21 changes: 21 additions & 0 deletions modules/avored/contact/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 AvoRed E commerce

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions modules/avored/contact/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AvoRed E commerce Dummy Data

AvoRed E commerce Dummy Data
42 changes: 42 additions & 0 deletions modules/avored/contact/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"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]"
}
],
"require" : {
"php" : ">=7.1.3",
"avored/module-installer" : "1.*",
"avored/framework" : "~2.0"
},
"autoload" : {
"psr-4" : {
"AvoRed\\Contact\\" : "src"
}
},
"homepage" : "https://www.avored.com/",
"support" : {
"email" : "[email protected]",
"issues" : "https://www.avored.com/dicussion",
"forum" : "https://www.avored.com/discussion",
"wiki" : "https://www.avored.com/docs",
"source" : "https://www.github.com/avored/contact"
}
}
5 changes: 5 additions & 0 deletions modules/avored/contact/register.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: AvoRed Contact Us
identifier: avored-contact
description: AvoRed Contact Module
namespace: AvoRed\Contact\
status: Enabled
10 changes: 10 additions & 0 deletions modules/avored/contact/resources/lang/en/contact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

<?php


return [




];
39 changes: 39 additions & 0 deletions modules/avored/contact/resources/views/contact/index.blade.php
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
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
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
22 changes: 22 additions & 0 deletions modules/avored/contact/routes/web.php
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.
|
*/
use Illuminate\Support\Facades\Route;

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');

});
31 changes: 31 additions & 0 deletions modules/avored/contact/src/Http/Controllers/ContactController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace AvoRed\Contact\Http\Controllers;

use AvoRed\Contact\Http\Requests\ContactRequest;
use AvoRed\Framework\Models\Database\Configuration;
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) {

$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!');
}
}
33 changes: 33 additions & 0 deletions modules/avored/contact/src/Http/Requests/ContactRequest.php
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;
}
}
24 changes: 24 additions & 0 deletions modules/avored/contact/src/Mails/ContactMail.php
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');
}
}
59 changes: 59 additions & 0 deletions modules/avored/contact/src/Mails/ContactMailRequest.php
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");

}
}
Loading

0 comments on commit 567ccca

Please sign in to comment.