release
This commit is contained in:
@ -82,11 +82,13 @@ class EventCrudController extends CrudController
|
||||
'label' => trans('backend.columnName.post_at'),
|
||||
'type' => 'datetime',
|
||||
'format' => 'YYYY/MM/DD HH:mm:SS',
|
||||
'default' => \Carbon\Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'is_front_show',
|
||||
'label' => trans('backend.columnName.is_front_show'),
|
||||
'type' => 'boolean'
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'title',
|
||||
@ -104,6 +106,13 @@ class EventCrudController extends CrudController
|
||||
'showSingleChoise' => '0', // 0=hidden, 1=show(default)
|
||||
'showComment' => '0', // 0=hidden, 1=show(default)
|
||||
],
|
||||
[
|
||||
'name' => 'event_at',
|
||||
'label' => trans('backend.columnName.event_at'),
|
||||
'type' => 'datetime',
|
||||
'format' => 'YYYY/MM/DD HH:mm:SS',
|
||||
'default' => \Carbon\Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'venue',
|
||||
'label' => trans('backend.columnName.venue'),
|
||||
@ -122,9 +131,9 @@ class EventCrudController extends CrudController
|
||||
'options' => [
|
||||
//'selector' => 'textarea.tinymce',
|
||||
//'skin' => 'dick-light',
|
||||
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'plugins' => 'code lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'menubar' => 'edit insert view format help',
|
||||
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'toolbar' => 'code undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'language' => str_replace('-', '_', app()->getLocale()),
|
||||
'height' => '500px',
|
||||
],
|
||||
|
@ -19,7 +19,17 @@ class HomeCarouselCrudController extends CrudController
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
|
||||
//use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
|
||||
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation { destroy as traitDestroy; }
|
||||
public function destroy($id)
|
||||
{
|
||||
//CRUD::hasAccessOrFail('delete');
|
||||
if (\App\Models\HomeCarousel::count() <= 7)
|
||||
{
|
||||
$this->crud->allowAccess('create');
|
||||
}
|
||||
|
||||
return CRUD::delete($id);
|
||||
}
|
||||
/**
|
||||
* Configure the CrudPanel object. Apply settings to all operations.
|
||||
*
|
||||
@ -31,6 +41,7 @@ class HomeCarouselCrudController extends CrudController
|
||||
CRUD::setRoute(config('backpack.base.route_prefix') . '/home-carousel');
|
||||
CRUD::setEntityNameStrings(trans('backend.home_carousel.content.item'), trans('backend.home_carousel.content.items'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function setupReorderOperation()
|
||||
@ -51,6 +62,15 @@ class HomeCarouselCrudController extends CrudController
|
||||
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
|
||||
}
|
||||
|
||||
if (\App\Models\HomeCarousel::count() >= 6)
|
||||
{
|
||||
$this->crud->denyAccess('create');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->crud->allowAccess('create');
|
||||
}
|
||||
|
||||
$this->crud->addColumns([
|
||||
[
|
||||
'name' => 'is_front_show',
|
||||
@ -96,6 +116,17 @@ class HomeCarouselCrudController extends CrudController
|
||||
'label' => trans('backend.columnName.link'),
|
||||
'type' => 'text'
|
||||
],
|
||||
[
|
||||
'name' => 'featured_photos',
|
||||
'label' => trans('backend.columnName.featured_img'),
|
||||
'type' => 'upload_img_multiple',
|
||||
'upload' => true,
|
||||
'disk' => 'public',
|
||||
'hint' => '',
|
||||
'qty' => 1, // 0=no limit, >0=limit
|
||||
'showSingleChoise' => '0', // 0=hidden, 1=show(default)
|
||||
'showComment' => '0', // 0=hidden, 1=show(default)
|
||||
],
|
||||
[
|
||||
'name' => 'photos',
|
||||
'label' => trans('backend.columnName.cover'),
|
||||
|
@ -82,16 +82,20 @@ class NewsCrudController extends CrudController
|
||||
'label' => trans('backend.columnName.post_at'),
|
||||
'type' => 'datetime',
|
||||
'format' => 'YYYY/MM/DD HH:mm:SS',
|
||||
'default' => \Carbon\Carbon::now(),
|
||||
],
|
||||
[
|
||||
'name' => 'is_front_show',
|
||||
'label' => trans('backend.columnName.is_front_show'),
|
||||
'type' => 'boolean'
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
|
||||
],
|
||||
[
|
||||
'name' => 'title',
|
||||
'label' => trans('backend.columnName.title'),
|
||||
'type' => 'text'
|
||||
'type' => 'text',
|
||||
|
||||
],
|
||||
[
|
||||
'name' => 'photos',
|
||||
@ -117,9 +121,9 @@ class NewsCrudController extends CrudController
|
||||
'options' => [
|
||||
//'selector' => 'textarea.tinymce',
|
||||
//'skin' => 'dick-light',
|
||||
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'plugins' => 'code lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'menubar' => 'edit insert view format help',
|
||||
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'toolbar' => 'code undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'language' => str_replace('-', '_', app()->getLocale()),
|
||||
'height' => '500px',
|
||||
],
|
||||
|
@ -132,7 +132,8 @@ class ProductCrudController extends CrudController
|
||||
[
|
||||
'name' => 'is_front_show',
|
||||
'label' => trans('backend.columnName.is_front_show'),
|
||||
'type' => 'boolean'
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'tip',
|
||||
@ -168,9 +169,9 @@ class ProductCrudController extends CrudController
|
||||
'options' => [
|
||||
//'selector' => 'textarea.tinymce',
|
||||
//'skin' => 'dick-light',
|
||||
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'plugins' => 'code lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'menubar' => 'edit insert view format help',
|
||||
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'toolbar' => 'code undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'language' => str_replace('-', '_', app()->getLocale()),
|
||||
'height' => '500px',
|
||||
],
|
||||
@ -183,9 +184,9 @@ class ProductCrudController extends CrudController
|
||||
'options' => [
|
||||
//'selector' => 'textarea.tinymce',
|
||||
//'skin' => 'dick-light',
|
||||
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'plugins' => 'code lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'menubar' => 'edit insert view format help',
|
||||
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'toolbar' => 'code undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'language' => str_replace('-', '_', app()->getLocale()),
|
||||
'height' => '500px',
|
||||
],
|
||||
@ -199,13 +200,61 @@ class ProductCrudController extends CrudController
|
||||
'options' => [
|
||||
//'selector' => 'textarea.tinymce',
|
||||
//'skin' => 'dick-light',
|
||||
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'plugins' => 'code lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'menubar' => 'edit insert view format help',
|
||||
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'toolbar' => 'code undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'language' => str_replace('-', '_', app()->getLocale()),
|
||||
'height' => '500px',
|
||||
],
|
||||
],
|
||||
|
||||
[
|
||||
'name' => 'feature_resource',
|
||||
'lable' => trans('backend.columnName.feature_resource'),
|
||||
'type' => 'tinymce',
|
||||
// optional overwrite of the configuration array
|
||||
'options' => [
|
||||
//'selector' => 'textarea.tinymce',
|
||||
//'skin' => 'dick-light',
|
||||
'plugins' => 'code lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'menubar' => 'edit insert view format help',
|
||||
'toolbar' => 'code undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'language' => str_replace('-', '_', app()->getLocale()),
|
||||
'height' => '500px',
|
||||
],
|
||||
],
|
||||
|
||||
[
|
||||
'name' => 'feature_related_part',
|
||||
'lable' => trans('backend.columnName.feature_related_part'),
|
||||
'type' => 'tinymce',
|
||||
// optional overwrite of the configuration array
|
||||
'options' => [
|
||||
//'selector' => 'textarea.tinymce',
|
||||
//'skin' => 'dick-light',
|
||||
'plugins' => 'code lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
|
||||
'menubar' => 'edit insert view format help',
|
||||
'toolbar' => 'code undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
|
||||
'language' => str_replace('-', '_', app()->getLocale()),
|
||||
'height' => '500px',
|
||||
],
|
||||
],
|
||||
|
||||
[
|
||||
'name' => 'productRelateds',
|
||||
'label' => trans('backend.columnName.product_related'),
|
||||
'type' => 'select2_multiple',
|
||||
'entity' => 'productRelateds',
|
||||
'attribute' => 'title',
|
||||
'model' => 'App\Models\Product',
|
||||
'pivot' => true,
|
||||
'allows_null' => true,
|
||||
'select_all' => true,
|
||||
'options' => (function ($query) {
|
||||
$id = \Route::current()->parameter('id');
|
||||
return $query->where('id', '<>', $id)->orderBy('title', 'ASC')->get();
|
||||
}),
|
||||
],
|
||||
|
||||
[
|
||||
'name' => 'seo_keyword',
|
||||
|
@ -97,7 +97,8 @@ class SupportDistributionPartnerCrudController extends CrudController
|
||||
[
|
||||
'name' => 'is_front_show',
|
||||
'label' => trans('backend.columnName.is_front_show'),
|
||||
'type' => 'boolean'
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'photos',
|
||||
|
@ -97,7 +97,8 @@ class SupportEcosystemPartnerCrudController extends CrudController
|
||||
[
|
||||
'name' => 'is_front_show',
|
||||
'label' => trans('backend.columnName.is_front_show'),
|
||||
'type' => 'boolean'
|
||||
'type' => 'boolean',
|
||||
'default' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'photos',
|
||||
|
@ -24,6 +24,26 @@ class UserCrudController extends OrgController
|
||||
'label' => trans('backpack::permissionmanager.email'),
|
||||
'type' => 'email',
|
||||
],
|
||||
[
|
||||
'name' => 'phone',
|
||||
'label' => trans('backend.columnName.phone'),
|
||||
'type' => 'text',
|
||||
],
|
||||
[
|
||||
'name' => 'country',
|
||||
'label' => trans('backend.columnName.country'),
|
||||
'type' => 'text',
|
||||
],
|
||||
[
|
||||
'name' => 'company',
|
||||
'label' => trans('backend.columnName.company'),
|
||||
'type' => 'text',
|
||||
],
|
||||
[
|
||||
'name' => 'job_title',
|
||||
'label' => trans('backend.columnName.job_title'),
|
||||
'type' => 'text',
|
||||
],
|
||||
[ // n-n relationship (with pivot table)
|
||||
'label' => trans('backpack::permissionmanager.roles'), // Table column heading
|
||||
'type' => 'select_multiple',
|
||||
|
@ -15,7 +15,7 @@ class EventsController extends Controller
|
||||
|
||||
$dataRows = \App\Models\Event::where('is_front_show', '=', true)
|
||||
->orderBy('post_at', 'desc')
|
||||
->select('id', 'title', 'venue', 'contact', 'photos', 'post_at');
|
||||
->select('id', 'title', 'venue', 'event_at', 'contact', 'photos', 'post_at');
|
||||
|
||||
return view('events', [
|
||||
'dataRows' => $dataRows->skip($pageOffset)->take($perPageItems)->get(),
|
||||
|
@ -3,6 +3,9 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\SubscripeionMail;
|
||||
use Validator;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
@ -14,7 +17,7 @@ class HomeController extends Controller
|
||||
$newsRows = \App\Models\News::where('is_front_show', '=', true)
|
||||
->orderBy('post_at', 'desc')
|
||||
->take('3');
|
||||
$eventRows = \App\Models\News::where('is_front_show', '=', true)
|
||||
$eventRows = \App\Models\Event::where('is_front_show', '=', true)
|
||||
->orderBy('post_at', 'desc')
|
||||
->take('3');
|
||||
return view('home', [
|
||||
@ -23,4 +26,53 @@ class HomeController extends Controller
|
||||
'eventRows' => $eventRows->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function indexPost(Request $request)
|
||||
{
|
||||
$message = '';
|
||||
$result = 'success';
|
||||
$subscribeInquery = $request->input('subscribeInquery');
|
||||
if ($subscribeInquery)
|
||||
{
|
||||
try
|
||||
{
|
||||
//$request->validate();
|
||||
$validator = Validator::make($request->all(), [
|
||||
'subscribeInquery' => 'required|email',
|
||||
], $messages = [
|
||||
'required' => 'The :attribute field is required.',
|
||||
'email' => 'The :attribute field is not a email address.',
|
||||
]);
|
||||
if ($validator->fails())
|
||||
{
|
||||
$result = 'errorSubscribe';
|
||||
$message = 'Opps! Please try again.';
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
Mail::to('newsletter.cri@coreality-inc.com')->send(
|
||||
new SubscripeionMail($subscribeInquery)
|
||||
);
|
||||
$result = 'successSubscribe';
|
||||
$message = 'We have received your subscribe inquiry!';
|
||||
}
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
$result = 'errorSubscribe';
|
||||
$message = 'Opps! Please try again.';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($message != '')
|
||||
{
|
||||
return redirect()->back()->with($result, $message);
|
||||
}
|
||||
else
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
}
|
||||
|
56
app/Http/Controllers/LoginController.php
Normal file
56
app/Http/Controllers/LoginController.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\LoginRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display login page.
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle account login request
|
||||
*
|
||||
* @param LoginRequest $request
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function login(LoginRequest $request)
|
||||
{
|
||||
$credentials = $request->getCredentials();
|
||||
|
||||
if(!Auth::validate($credentials)):
|
||||
return redirect()->to('login')
|
||||
->withErrors(trans('auth.failed'));
|
||||
endif;
|
||||
|
||||
$user = Auth::getProvider()->retrieveByCredentials($credentials);
|
||||
|
||||
Auth::login($user);
|
||||
|
||||
return $this->authenticated($request, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle response after user authenticated
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Auth $user
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function authenticated(Request $request, $user)
|
||||
{
|
||||
return redirect()->intended();
|
||||
}
|
||||
}
|
24
app/Http/Controllers/LogoutController.php
Normal file
24
app/Http/Controllers/LogoutController.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class LogoutController extends Controller
|
||||
{
|
||||
/**
|
||||
* Log out account user.
|
||||
*
|
||||
* @return \Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function perform()
|
||||
{
|
||||
Session::flush();
|
||||
|
||||
Auth::logout();
|
||||
|
||||
return redirect('login');
|
||||
}
|
||||
}
|
@ -19,12 +19,8 @@ class ProductsController extends Controller
|
||||
$pageOffset = $perPageItems * ($page - 1);
|
||||
|
||||
$productRows = \App\Models\Product::where('is_front_show', '=', true)
|
||||
->orderByRaw("CASE
|
||||
WHEN tip = 'none' THEN 1
|
||||
WHEN tip = 'new' THEN 2
|
||||
WHEN tip = 'on_sale' THEN 3
|
||||
END DESC")
|
||||
->orderBy('id', 'DESC');
|
||||
->orderByRaw("CASE WHEN tip LIKE 'on_sale' THEN 1 WHEN tip LIKE 'new' THEN 2 ELSE 3 END");
|
||||
//->orderBy('id', 'DESC');
|
||||
|
||||
$dataCatalogs = \App\Models\ProductCatalog::where('is_front_show', '=', true)
|
||||
->orderBy('lft', 'asc')
|
||||
@ -61,7 +57,9 @@ class ProductsController extends Controller
|
||||
|
||||
|
||||
$productCount = $productRows->count();
|
||||
$productRows = $productRows->skip($pageOffset)->take($perPageItems)->get();
|
||||
$productRows = $productRows->skip($pageOffset)->take($perPageItems);
|
||||
//var_dump($productRows->toSql());
|
||||
$productRows = $productRows->get();
|
||||
foreach ($productRows as $row)
|
||||
{
|
||||
$row->{'applications'} = \App\Models\Product::find($row->id)->productApplications()->get();
|
||||
@ -105,6 +103,7 @@ class ProductsController extends Controller
|
||||
'catalogName' => $catalogName,
|
||||
'catalogSlug' => $catalogSlug,
|
||||
'productApplications' => $dataRow->productApplications()->get(),
|
||||
'productRelateds' => $dataRow->productRelateds()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
36
app/Http/Controllers/RegisterController.php
Normal file
36
app/Http/Controllers/RegisterController.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\RegisterRequest;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display register page.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return view('auth.register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle account registration request
|
||||
*
|
||||
* @param RegisterRequest $request
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function register(RegisterRequest $request)
|
||||
{
|
||||
$user = User::create($request->validated());
|
||||
|
||||
auth()->login($user);
|
||||
|
||||
return redirect('/')->with('success', "Account successfully registered.");
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ class SupportDistributionPartnersController extends Controller
|
||||
|
||||
$dataRows = \App\Models\SupportDistributionPartner::where('support_distribution_partner_catalog_id', '=', $catalogId)
|
||||
->where('is_front_show', '=', true)
|
||||
->orderBy('title', 'desc')
|
||||
->orderBy('title', 'asc')
|
||||
->select('id', 'title', 'description', 'photos', 'website');
|
||||
|
||||
return view('support-distribution-partners', [
|
||||
|
@ -21,12 +21,21 @@ class SupportEcosystemPartnersController extends Controller
|
||||
->orderBy('lft', 'asc')
|
||||
->orderBy('id', 'desc')
|
||||
->select('id', 'name');
|
||||
if ($catalogId == 0)
|
||||
{
|
||||
$catalogRowsGet = $catalogRows->get();
|
||||
foreach ($catalogRowsGet as $row)
|
||||
{
|
||||
$catalogId = $row->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$dataRows = \App\Models\SupportEcosystemPartner::where('support_ecosystem_partner_catalog_id', '=', $catalogId)
|
||||
->where('is_front_show', '=', true)
|
||||
->orderBy('title', 'desc')
|
||||
->orderBy('title', 'asc')
|
||||
->select('id', 'title', 'description', 'photos', 'website');
|
||||
|
||||
|
||||
return view('support-ecosystem-partners', [
|
||||
'catalogRows' => $catalogRows->get(),
|
||||
'catalogCurrentId' => $catalogId,
|
||||
|
@ -5,16 +5,26 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Http\Requests\SupportSaleRequest;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\SalesInquiryMail;
|
||||
|
||||
class SupportSalesInquiryController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$product = '';
|
||||
$pid = $request->get('pid');
|
||||
$product = \App\Models\Product::where('id', '=', $pid)->where('is_front_show', '=', true)->first();
|
||||
if ($product)
|
||||
if ($pid > 0)
|
||||
{
|
||||
$product = 'I am interested in ' . $product->title;
|
||||
$product = \App\Models\Product::where('id', '=', $pid)->where('is_front_show', '=', true)->first();
|
||||
if ($product)
|
||||
{
|
||||
$product = 'I am interested in ' . $product->title;
|
||||
}
|
||||
}
|
||||
else if ($request->has('comment'))
|
||||
{
|
||||
$product = $request->get('comment');
|
||||
}
|
||||
return view('support-sales-inquiry',[
|
||||
'productName' => $product,
|
||||
@ -34,6 +44,28 @@ class SupportSalesInquiryController extends Controller
|
||||
'comments' => $request->input('comments'),
|
||||
'created_at' => Carbon::now(),
|
||||
]);
|
||||
|
||||
try
|
||||
{
|
||||
$data = 'First Name: ' . $request->input('name_first') . "\n";
|
||||
$data .= 'Last Name: ' . $request->input('name_last') . "\n";
|
||||
$data .= 'Company Name: ' . $request->input('company_name') . "\n";
|
||||
$data .= 'Job Title: ' . $request->input('job_title') . "\n";
|
||||
$data .= 'Email: ' . $request->input('email') . "\n";
|
||||
$data .= 'Phone: ' . $request->input('phone') . "\n";
|
||||
$data .= 'Contry: ' . $request->input('contry') . "\n";
|
||||
$data .= 'Comments: ' . $request->input('comments') . "\n";
|
||||
$data .= 'Created At ' . Carbon::now() . "\n";
|
||||
|
||||
Mail::to('sales.cri@coreality-inc.com')->send(
|
||||
new SalesInquiryMail($data)
|
||||
);
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return redirect()->back()->with('success', 'We have received your sales inquiry!');
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Http\Requests\SupportTechnicalRequest;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\CustomerServiceMail;
|
||||
|
||||
class SupportTechnicalController extends Controller
|
||||
{
|
||||
@ -26,6 +28,27 @@ class SupportTechnicalController extends Controller
|
||||
'comments' => $request->input('comments'),
|
||||
'created_at' => Carbon::now(),
|
||||
]);
|
||||
return redirect()->back()->with('success', 'We have received your technical inquiry!');
|
||||
|
||||
try
|
||||
{
|
||||
$data = 'First Name: ' . $request->input('name_first') . "\n";
|
||||
$data .= 'Last Name: ' . $request->input('name_last') . "\n";
|
||||
$data .= 'Company Name: ' . $request->input('company_name') . "\n";
|
||||
$data .= 'Job Title: ' . $request->input('job_title') . "\n";
|
||||
$data .= 'Email: ' . $request->input('email') . "\n";
|
||||
$data .= 'Phone: ' . $request->input('phone') . "\n";
|
||||
$data .= 'Contry: ' . $request->input('contry') . "\n";
|
||||
$data .= 'Comments: ' . $request->input('comments') . "\n";
|
||||
$data .= 'Created At ' . Carbon::now() . "\n";
|
||||
|
||||
Mail::to('service.cri@coreality-inc.com')->send(
|
||||
new CustomerServiceMail($data)
|
||||
);
|
||||
}
|
||||
catch (Exception $ex)
|
||||
{
|
||||
|
||||
}
|
||||
return redirect()->back()->with('success', 'We have received your customer sercvice inquiry!');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user