Initial Commit
This commit is contained in:
7
app/Commands/Command.php
Normal file
7
app/Commands/Command.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php namespace App\Commands;
|
||||
|
||||
abstract class Command {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
32
app/Console/Commands/Inspire.php
Normal file
32
app/Console/Commands/Inspire.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
|
||||
class Inspire extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'inspire';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Display an inspiring quote';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
|
||||
}
|
||||
29
app/Console/Kernel.php
Normal file
29
app/Console/Kernel.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel {
|
||||
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
'App\Console\Commands\Inspire',
|
||||
];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('inspire')
|
||||
->hourly();
|
||||
}
|
||||
|
||||
}
|
||||
7
app/Events/Event.php
Normal file
7
app/Events/Event.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php namespace App\Events;
|
||||
|
||||
abstract class Event {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
42
app/Exceptions/Handler.php
Normal file
42
app/Exceptions/Handler.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
|
||||
class Handler extends ExceptionHandler {
|
||||
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
'Symfony\Component\HttpKernel\Exception\HttpException'
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
{
|
||||
return parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
}
|
||||
0
app/Handlers/Commands/.gitkeep
Normal file
0
app/Handlers/Commands/.gitkeep
Normal file
0
app/Handlers/Events/.gitkeep
Normal file
0
app/Handlers/Events/.gitkeep
Normal file
40
app/Http/Controllers/Auth/AuthController.php
Normal file
40
app/Http/Controllers/Auth/AuthController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\Registrar;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
|
||||
class AuthController extends Controller {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Registration & Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users, as well as the
|
||||
| authentication of existing users. By default, this controller uses
|
||||
| a simple trait to add these behaviors. Why don't you explore it?
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new authentication controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function __construct(Guard $auth, Registrar $registrar)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->registrar = $registrar;
|
||||
|
||||
$this->middleware('guest', ['except' => 'getLogout']);
|
||||
}
|
||||
|
||||
}
|
||||
39
app/Http/Controllers/Auth/PasswordController.php
Normal file
39
app/Http/Controllers/Auth/PasswordController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class PasswordController extends Controller {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
protected $redirectPath = '/user';
|
||||
|
||||
/**
|
||||
* Create a new password controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, PasswordBroker $passwords)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->passwords = $passwords;
|
||||
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
}
|
||||
11
app/Http/Controllers/Controller.php
Normal file
11
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesCommands;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
|
||||
abstract class Controller extends BaseController {
|
||||
|
||||
use DispatchesCommands, ValidatesRequests;
|
||||
|
||||
}
|
||||
97
app/Http/Controllers/CustomAuthController.php
Normal file
97
app/Http/Controllers/CustomAuthController.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Auth;
|
||||
use App\Traits\CaptchaTrait;
|
||||
use App\User;
|
||||
use Validator;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CustomAuthController extends Controller {
|
||||
use CaptchaTrait;
|
||||
|
||||
public function authenticate(Request $request){
|
||||
|
||||
$post = $request->all();
|
||||
$email = $post['email'];
|
||||
$password = $post['password'];
|
||||
|
||||
if (Auth::attempt(['email' => $email, 'password' => $password])){
|
||||
$message = "success";
|
||||
$navbar = view('layout.navbar', compact('view'))->render();
|
||||
$save_design_button = ' <button type="button" class="btn btn-lg btn-primary pull-right" data-toggle="modal" data-target="#modalDesignName"><i class="fa fa-floppy-o" aria-hidden="true"></i> Save Design</button>';
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true,
|
||||
'message'=>$message,
|
||||
'navbar'=>$navbar,
|
||||
'save_design_button' => $save_design_button
|
||||
));
|
||||
}else{
|
||||
|
||||
$message = '
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
Username or Password is incorrect.
|
||||
</div>';
|
||||
|
||||
return response()->json(array('success' => false, 'message'=>$message));
|
||||
}
|
||||
}
|
||||
|
||||
public function postRegister(Request $request){
|
||||
$post = $request->all();
|
||||
|
||||
$post['captcha'] = $this->captchaCheck();
|
||||
|
||||
$validator = Validator::make($post, [
|
||||
'username' => 'unique:user_logins',
|
||||
'email' => 'unique:user_logins',
|
||||
'g-recaptcha-response' => 'required',
|
||||
'captcha' => 'required|min:1'
|
||||
],
|
||||
[
|
||||
'g-recaptcha-response.required' => 'Captcha is required',
|
||||
'captcha.min' => 'Wrong captcha, please try again.'
|
||||
]);
|
||||
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
$errors = "";
|
||||
foreach($validator->errors()->all() as $error){
|
||||
$errors .= "<li>".$error."</li>";
|
||||
}
|
||||
|
||||
$message = '
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-ban"></i> ERROR:</h4>
|
||||
'.$errors.
|
||||
'</div>';
|
||||
|
||||
return response()->json(array(
|
||||
'success' => false,
|
||||
'message' => $message
|
||||
));
|
||||
}
|
||||
|
||||
User::create([
|
||||
'name' => $post['name'],
|
||||
'username' => $post['username'],
|
||||
'email' => $post['email'],
|
||||
'password' => bcrypt($post['password']),
|
||||
'role' => 'user'
|
||||
]);
|
||||
|
||||
Auth::attempt(['email' => $post['email'], 'password' => $post['password']]);
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
36
app/Http/Controllers/HomeController.php
Normal file
36
app/Http/Controllers/HomeController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
class HomeController extends Controller {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Home Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller renders your application's "dashboard" for users that
|
||||
| are authenticated. Of course, you are free to change or remove the
|
||||
| controller as you wish. It is just here to get your app started!
|
||||
|
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard to the user.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('home');
|
||||
}
|
||||
|
||||
}
|
||||
142
app/Http/Controllers/MainController.php
Normal file
142
app/Http/Controllers/MainController.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\MainModel;
|
||||
// use Illuminate\Support\Facades\Request;
|
||||
|
||||
class MainController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('sublayouts.index');
|
||||
}
|
||||
|
||||
public function sports()
|
||||
{
|
||||
// if(Request::ajax()){
|
||||
$m = new MainModel;
|
||||
$fetchData = $m->selectAllSports();
|
||||
//var_dump($fetchData);
|
||||
|
||||
foreach ($fetchData as $row) {
|
||||
?>
|
||||
<div class="col-md-3 col-sm-6 col-xs-12 list-sport">
|
||||
<!-- <h2 class="text-center">Basketball</h2> -->
|
||||
<div>
|
||||
<!-- <span class="badge">Sale</span> -->
|
||||
<a href="<?php echo url('sports') . "/" . $row->URL; ?>"><img src="<?php echo url('public') ."/". $row->Thumbnail; ?>" alt="" class="img img-responsive product-center" /></a>
|
||||
<h3 class="text-center sports-title"><?php echo $row->SportsName ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
// }else{
|
||||
// return response()->view('errors/403');
|
||||
// }
|
||||
}
|
||||
|
||||
public function templatesCat($url)
|
||||
{
|
||||
$m = new MainModel;
|
||||
|
||||
$data = $m->selectSportsId($url);
|
||||
$categoryids = array();
|
||||
|
||||
foreach($data as $row){
|
||||
$categoryids[] = $row->Category;
|
||||
}
|
||||
|
||||
$array_sports = $m->selectSportsByURL($url);
|
||||
$array_category = $m->selectCategory($categoryids);
|
||||
// $array_templateby_category = $m->selectTemplatesByCategory($url, $id);
|
||||
|
||||
// var_dump($array_category);
|
||||
|
||||
return view('sublayouts.sports-category')
|
||||
->with('array_sports', $array_sports)
|
||||
->with('row', $array_category);
|
||||
}
|
||||
|
||||
|
||||
public function templatesByCategory($url, $id)
|
||||
{
|
||||
$m = new MainModel;
|
||||
$data = $m->selectTemplatesByCategory($url, $id);
|
||||
return view('sublayouts.sports-styles')
|
||||
->with('cat', $url)
|
||||
->with('row', $data);
|
||||
// if(count($data) > 1){
|
||||
// return view('sublayouts.sports-styles')
|
||||
// ->with('cat', $url)
|
||||
// ->with('row', $data);
|
||||
// }else{
|
||||
// $url = url('/designer'). '/'.$data[0]->HashTemplateCode; // desinger url
|
||||
// return redirect()->to($url);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public function fetchTemplates()
|
||||
{
|
||||
// if(Request::ajax()){
|
||||
// $m = new MainModel;
|
||||
//
|
||||
// $data = $m->selectSportsId($url);
|
||||
// echo $data[0]->id;
|
||||
//$fetchData = $m->selectSportsTemplates();
|
||||
|
||||
|
||||
//var_dump($fetchData);
|
||||
|
||||
// }else{
|
||||
// return response()->view('errors/403');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function countCart(Request $request){
|
||||
|
||||
$m = new MainModel;
|
||||
|
||||
if($request->session()->has('cartkey')){
|
||||
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
|
||||
echo $i = $m->cartCount($cartKey);
|
||||
|
||||
|
||||
}else{
|
||||
echo 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function removeCartItem($id){
|
||||
|
||||
$m = new MainModel;
|
||||
|
||||
$row = $m->removeItem($id);
|
||||
if($row > 0)
|
||||
{
|
||||
// \Session::flash('message', 'Record successfully deleted.');
|
||||
echo '<script>
|
||||
alert("Item removed");
|
||||
</script>';
|
||||
return redirect('cart');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
53
app/Http/Controllers/PatternsController.php
Normal file
53
app/Http/Controllers/PatternsController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Support\Facades\Request1;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\PatternsModel;
|
||||
|
||||
class PatternsController extends Controller {
|
||||
|
||||
public function getPatterns()
|
||||
{
|
||||
//if(Request::ajax()){
|
||||
$m = new PatternsModel;
|
||||
$data = $m->selectAllPattern();
|
||||
|
||||
foreach ($data as $row) {
|
||||
if($row->PatternName == "None"){
|
||||
echo '<option value="'.$row->PatternId.'" data-img="'.url("/public/images"). "/" .$row->PatternThumbnail.'" selected="selected" aria-disabled="true" disabled>'.$row->PatternName.'</option>';
|
||||
}else{
|
||||
echo '<option value="'.$row->PatternId.'" data-img="'.url("/public/images"). "/" .$row->PatternThumbnail.'">'.$row->PatternName.'</option>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
public function getPatternsWithPostValue(Request $request)
|
||||
{
|
||||
$m = new PatternsModel;
|
||||
$data = $m->selectAllPattern();
|
||||
|
||||
$post = $request->all();
|
||||
|
||||
$pattern_list = array();
|
||||
foreach($post['patterns'] as $pt) {
|
||||
$pattern_list[] = $pt;
|
||||
//echo $pt;
|
||||
}
|
||||
|
||||
foreach ($data as $row) {
|
||||
if(in_array($row->PatternId, $pattern_list)) {
|
||||
echo '<option value="'.$row->PatternId.'" data-img="'.url("/public/images"). "/" . $row->PatternThumbnail.'" selected="selected">'.$row->PatternName.'</option>';
|
||||
}else{
|
||||
echo '<option value="'.$row->PatternId.'" data-img="'.url("/public/images"). "/" . $row->PatternThumbnail.'" >'.$row->PatternName.'</option>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
79
app/Http/Controllers/PrintPatternController.php
Normal file
79
app/Http/Controllers/PrintPatternController.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Support\Facades\Request1;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\PrintPatternModel;
|
||||
use App\Models\SizesModel;
|
||||
|
||||
class PrintPatternController extends Controller {
|
||||
|
||||
public function showPrintTemplate()
|
||||
{
|
||||
$m = new PrintPatternModel;
|
||||
$data = $m->selectAllPrintTemplate();
|
||||
return view('sub_pages.sports_details')->with('data', $data);
|
||||
}
|
||||
|
||||
public function displayAddPrintTemplatePage($tempcode)
|
||||
{
|
||||
$m = new SizesModel;
|
||||
$data = $m->selectAllSizes();
|
||||
|
||||
//var_dump($tempcode);
|
||||
return view('sub_pages.add_print_template')->with('sizeslist', $data)->with('templatecode', $tempcode);
|
||||
}
|
||||
|
||||
public function savePrintPattern (Request $request)
|
||||
{
|
||||
$m = new PrintPatternModel;
|
||||
|
||||
$post = $request->all();
|
||||
|
||||
$templatecode = $post['templatecode'];
|
||||
$templateType = $post['templateType'];
|
||||
$templateSize = $post['templateSize'];
|
||||
|
||||
$rawName = $request->file('preview_print_template')->getClientOriginalName();
|
||||
$imageExt = $request->file('preview_print_template')->getClientOriginalExtension();
|
||||
|
||||
$custom_file_name = str_replace(' ','-',strtolower($rawName));
|
||||
$custom_file_name = preg_replace("/\.[^.\s]{3,4}$/", "", $custom_file_name);
|
||||
|
||||
|
||||
$NewImageName = $templateSize.'.'.$imageExt;
|
||||
|
||||
|
||||
$thumbnail = "uniform-templates/".$templatecode."/".$templateType."/SIZES/" . $NewImageName;
|
||||
|
||||
$data = array(
|
||||
'TemplateCode' => $templatecode,
|
||||
'Path' => $thumbnail,
|
||||
'Type' => $templateType,
|
||||
'Size' => $templateSize
|
||||
);
|
||||
|
||||
$i = $m->insertPrintPattern($data);
|
||||
//var_dump($data);
|
||||
if($i){
|
||||
$r = $request->file('preview_print_template')->move(
|
||||
base_path() . "/public/images/uniform-templates/".$templatecode."/".$templateType."/SIZES/", $NewImageName
|
||||
);
|
||||
echo '<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
Print Pattern is successfully uploaded.
|
||||
</div>';
|
||||
}else{
|
||||
echo '<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Error!</h4>
|
||||
Failed to upload.
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
10
app/Http/Controllers/SizesController.php
Normal file
10
app/Http/Controllers/SizesController.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SizesController extends Controller {
|
||||
|
||||
}
|
||||
135
app/Http/Controllers/SportsController.php
Normal file
135
app/Http/Controllers/SportsController.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Support\Facades\Request1;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\SportsModel;
|
||||
|
||||
class SportsController extends Controller {
|
||||
|
||||
public function displayAllSports()
|
||||
{
|
||||
$m = new SportsModel;
|
||||
$data = $m->selectAllSports();
|
||||
return view('sub_pages.sports')->with('row', $data);
|
||||
}
|
||||
|
||||
public function displayAddSportPage()
|
||||
{
|
||||
return view('sub_pages.add_sports');
|
||||
}
|
||||
|
||||
public function saveNewSports(Request $request)
|
||||
{
|
||||
$m = new SportsModel;
|
||||
$post = $request->all();
|
||||
|
||||
$rawName = date('Ymd') . "-" . time().'-'.$request->file('previewImg')->getClientOriginalName();
|
||||
$imageExt = $request->file('previewImg')->getClientOriginalExtension();
|
||||
|
||||
$custom_file_name = str_replace(' ','-',strtolower($rawName));
|
||||
$custom_file_name = preg_replace("/\.[^.\s]{3,4}$/", "", $custom_file_name);
|
||||
$NewImageName = $custom_file_name.'.'.$imageExt;
|
||||
$thumbnail = "images/sports-thumbnails/" . $NewImageName;
|
||||
$data = array(
|
||||
'SportsName' => $post['sportsName'],
|
||||
'URL' => $post['generatedUrl'],
|
||||
'Thumbnail' => $thumbnail,
|
||||
'IsActive' => 'FALSE',
|
||||
|
||||
);
|
||||
$i = $m->insertToSports($data);
|
||||
|
||||
if($i){
|
||||
$request->file('previewImg')->move(
|
||||
base_path() . '/public/images/sports-thumbnails', $NewImageName
|
||||
);
|
||||
|
||||
echo '<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
Sports is successfully added.
|
||||
</div>';
|
||||
}else{
|
||||
echo '<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Error!</h4>
|
||||
Failed to saved new sports.
|
||||
</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function sportsDetails($q)
|
||||
{
|
||||
$m = new SportsModel;
|
||||
$data = $m->selectSports($q);
|
||||
return view('sub_pages.sports_details')->with('data', $data);
|
||||
}
|
||||
|
||||
public function updateSports(Request $request)
|
||||
{
|
||||
$m = new SportsModel;
|
||||
$post = $request->all();
|
||||
|
||||
if(count($post) > 3){
|
||||
$rawName = date('Ymd') . "-" . time().'-'.$request->file('previewImg')->getClientOriginalName();
|
||||
$imageExt = $request->file('previewImg')->getClientOriginalExtension();
|
||||
|
||||
$custom_file_name = str_replace(' ','-',strtolower($rawName));
|
||||
$custom_file_name = preg_replace("/\.[^.\s]{3,4}$/", "", $custom_file_name);
|
||||
$NewImageName = $custom_file_name.'.'.$imageExt;
|
||||
$thumbnail = "images/sports-thumbnails/" . $NewImageName;
|
||||
$data = array(
|
||||
'SportsName' => $post['sportsName'],
|
||||
'URL' => $post['generatedUrl'],
|
||||
'Thumbnail' => $thumbnail
|
||||
|
||||
);
|
||||
$request->file('previewImg')->move(
|
||||
base_path() . '/public/images/sports-thumbnails', $NewImageName
|
||||
);
|
||||
}else{
|
||||
$data = array(
|
||||
'SportsName' => $post['sportsName'],
|
||||
'URL' => $post['generatedUrl']
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$i = $m->upateSportsDetails($data, $post['_id']);
|
||||
|
||||
if($i){
|
||||
|
||||
echo '<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
Sports details is successfully updated.
|
||||
</div>';
|
||||
}else{
|
||||
echo '<div class="alert alert-warning alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Warning!</h4>
|
||||
No changes made.
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
public function selectSportsName()
|
||||
{
|
||||
//if(Request1::ajax()){
|
||||
$m = new SportsModel;
|
||||
$data = $m->getSportsName();
|
||||
?>
|
||||
<option value="">--Select Sports--</option>
|
||||
<?php
|
||||
foreach ($data as $row) {
|
||||
echo '<option value="'.$row->Id.'">'.$row->SportsName.'</option>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
//}
|
||||
}
|
||||
}
|
||||
380
app/Http/Controllers/TemplatesController.php
Normal file
380
app/Http/Controllers/TemplatesController.php
Normal file
@@ -0,0 +1,380 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\TemplatesModel;
|
||||
use App\Models\SportsModel;
|
||||
use App\Models\PrintPatternModel;
|
||||
|
||||
class TemplatesController extends Controller {
|
||||
|
||||
public function displayTemplates()
|
||||
{
|
||||
return view('sub_pages.templates');
|
||||
}
|
||||
|
||||
public function displayEditTemplatePage($q)
|
||||
{
|
||||
//return view('sub_pages.edit_template');
|
||||
$m = new TemplatesModel;
|
||||
$m1 = new SportsModel;
|
||||
$m2 = new PrintPatternModel;
|
||||
|
||||
$templateData = $m->selectTemplate($q);
|
||||
$templatePathsData = $m->selectTemplatePaths($q); // plain svg for visualizer
|
||||
$templateTypes = $m->selectTemplateTypes();
|
||||
$sportsList = $m1->getSportsName();
|
||||
$printPatternList = $m2->selectAllPrintTemplate($q);
|
||||
|
||||
return view('sub_pages.edit_template')->with('templatedata', $templateData)->with('templatepath', $templatePathsData)->with('sportsname', $sportsList)->with('templatetype', $templateTypes)->with('printpattern', $printPatternList);
|
||||
}
|
||||
|
||||
|
||||
public function getTemplates(Request $request)
|
||||
{
|
||||
$m = new TemplatesModel;
|
||||
$post = $request->all();
|
||||
$data = $m->selectTemplates($post['id']);
|
||||
|
||||
// /public/images/sports-thumbnails
|
||||
|
||||
if(!empty($data)){
|
||||
foreach ($data as $row) {
|
||||
?>
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<div style="" class="text-center">
|
||||
<h3><?php echo $row->TemplateName ?></h3>
|
||||
</div>
|
||||
<div class="sports-border">
|
||||
<a href=""><img src="<?php echo url('public') . "/" . $row->Thumbnail ?>" alt="Sports" height="400px;" class="img img-responsive product-center" /></a>
|
||||
<div class="sport-edit-btn">
|
||||
<a href="<?php echo url('admin/templates') . "/edit/" . $row->TemplateCode . "/" ?>" class="btn btn-primary btn-block"><i class="fa fa-edit"></i> Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}else{
|
||||
echo '<script>
|
||||
alert("No available Template/s");
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
|
||||
public function displayAddTemplatePage()
|
||||
{
|
||||
return view('sub_pages.add_template');
|
||||
}
|
||||
|
||||
public function getTemplateTypes()
|
||||
{
|
||||
//if(Request::ajax()){
|
||||
$m = new TemplatesModel;
|
||||
$data = $m->selectTemplateTypes();
|
||||
?>
|
||||
|
||||
<option value="">--Select Type--</option>
|
||||
<?php
|
||||
foreach ($data as $row) {
|
||||
echo '<option value="'.$row->TemplateType.'">'.$row->TemplateType.'</option>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
//}
|
||||
}
|
||||
|
||||
public function getLastId()
|
||||
{
|
||||
//if(Request::ajax()){
|
||||
$m = new TemplatesModel;
|
||||
$data = $m->selectTemplateLastId();
|
||||
echo $templateCode = "TEMP-" . str_pad($data->Id + 1, 5,'0',STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
public function saveNewTemplates(Request $request)
|
||||
{
|
||||
$m = new TemplatesModel;
|
||||
$post = $request->all();
|
||||
|
||||
$templateCode = $post['templateCode'];
|
||||
$sportName = $post['sportName'];
|
||||
$templateName = $post['templateName'];
|
||||
$templateType = $post['templateType'];
|
||||
$numberOfTrims = $post['numberOfTrims'];
|
||||
$getSkins = $post['getSkins'];
|
||||
$tempateImage = $post['tempateImage'];
|
||||
|
||||
$rawName = date('Ymd') . "-" . time().'-'.$request->file('tempateImage')->getClientOriginalName();
|
||||
$imageExt = $request->file('tempateImage')->getClientOriginalExtension();
|
||||
|
||||
$custom_file_name = str_replace(' ','-',strtolower($rawName));
|
||||
$custom_file_name = preg_replace("/\.[^.\s]{3,4}$/", "", $custom_file_name);
|
||||
$NewImageName = $custom_file_name.'.'.$imageExt;
|
||||
$thumbnail = "images/templates/thumbnail/" . $NewImageName;
|
||||
|
||||
$data = array(
|
||||
'SportsId' => $sportName,
|
||||
'TemplateCode' => $templateCode,
|
||||
'Thumbnail' => $thumbnail,
|
||||
'TemplateName' => $templateName,
|
||||
'TemplateType' => $templateType,
|
||||
'Trim' => $numberOfTrims,
|
||||
'PatternId' => $getSkins,
|
||||
'IsActive' => 'TRUE'
|
||||
);
|
||||
|
||||
$i = $m->insertNewTempalte($data);
|
||||
|
||||
|
||||
if($i){
|
||||
$request->file('tempateImage')->move(
|
||||
base_path() . '/public/images/templates/thumbnail', $NewImageName
|
||||
);
|
||||
|
||||
//for front jersey
|
||||
if(!empty($request->file('svgJerseyFront')->getClientOriginalName())){
|
||||
|
||||
$svgName = $request->file('svgJerseyFront')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
//var_dump($svgThumbnail);
|
||||
$Templatedata = array(
|
||||
'TemplateCode' => $templateCode,
|
||||
'Type' => 'Jersey',
|
||||
'Side' => 'Front',
|
||||
'Path' => $svgThumbnail,
|
||||
'IsActive' => 'TRUE'
|
||||
);
|
||||
|
||||
$i = $m->insertTempaltePaths($Templatedata);
|
||||
if($i){
|
||||
$request->file('svgJerseyFront')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($request->file('svgJerseyBack')->getClientOriginalName())){
|
||||
|
||||
$svgName = $request->file('svgJerseyBack')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
|
||||
$Templatedata = array(
|
||||
'TemplateCode' => $templateCode,
|
||||
'Type' => 'Jersey',
|
||||
'Side' => 'Back',
|
||||
'Path' => $svgThumbnail,
|
||||
'IsActive' => 'TRUE'
|
||||
);
|
||||
|
||||
$i = $m->insertTempaltePaths($Templatedata);
|
||||
if($i){
|
||||
$request->file('svgJerseyBack')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($request->file('svgShortRight')->getClientOriginalName())){
|
||||
|
||||
$svgName = $request->file('svgShortRight')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
|
||||
$Templatedata = array(
|
||||
'TemplateCode' => $templateCode,
|
||||
'Type' => 'Shorts',
|
||||
'Side' => 'Right',
|
||||
'Path' => $svgThumbnail,
|
||||
'IsActive' => 'TRUE'
|
||||
);
|
||||
|
||||
$i = $m->insertTempaltePaths($Templatedata);
|
||||
if($i){
|
||||
$request->file('svgShortRight')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($request->file('svgShortLeft')->getClientOriginalName())){
|
||||
|
||||
$svgName = $request->file('svgShortLeft')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
|
||||
$Templatedata = array(
|
||||
'TemplateCode' => $templateCode,
|
||||
'Type' => 'Shorts',
|
||||
'Side' => 'Left',
|
||||
'Path' => $svgThumbnail,
|
||||
'IsActive' => 'TRUE'
|
||||
);
|
||||
|
||||
$i = $m->insertTempaltePaths($Templatedata);
|
||||
if($i){
|
||||
$request->file('svgShortLeft')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
Sports is successfully added.
|
||||
</div>';
|
||||
}else{
|
||||
echo '<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Error!</h4>
|
||||
Failed to saved new sports.
|
||||
</div>';
|
||||
}
|
||||
}
|
||||
|
||||
public function updateTemplate(Request $request)
|
||||
{
|
||||
$m = new TemplatesModel;
|
||||
$post = $request->all();
|
||||
// var_dump($post);
|
||||
// echo count($post);
|
||||
// var_dump($post);
|
||||
// var_dump(array_key_exists('svgShortRight', $post));
|
||||
|
||||
$templateCode = $post['templateCode'];
|
||||
$sportName = $post['sportName'];
|
||||
$templateName = $post['templateName'];
|
||||
$templateType = $post['templateType'];
|
||||
$numberOfTrims = $post['numberOfTrims'];
|
||||
$getSkins = $post['getSkins'];
|
||||
|
||||
if (array_key_exists('tempateImage', $post)) {
|
||||
|
||||
$tempateImage = $post['tempateImage'];
|
||||
|
||||
$rawName = date('Ymd') . "-" . time().'-'.$request->file('tempateImage')->getClientOriginalName();
|
||||
$imageExt = $request->file('tempateImage')->getClientOriginalExtension();
|
||||
|
||||
$custom_file_name = str_replace(' ','-',strtolower($rawName));
|
||||
$custom_file_name = preg_replace("/\.[^.\s]{3,4}$/", "", $custom_file_name);
|
||||
$NewImageName = $custom_file_name.'.'.$imageExt;
|
||||
$thumbnail = "images/templates/thumbnail/" . $NewImageName;
|
||||
|
||||
$data = array(
|
||||
'SportsId' => trim($sportName),
|
||||
'TemplateCode' => $templateCode,
|
||||
'Thumbnail' => $thumbnail,
|
||||
'TemplateName' => $templateName,
|
||||
'TemplateType' => trim($templateType),
|
||||
'Trim' => $numberOfTrims,
|
||||
'PatternId' => $getSkins
|
||||
);
|
||||
|
||||
$request->file('tempateImage')->move(
|
||||
base_path() . '/public/images/templates/thumbnail', $NewImageName
|
||||
);
|
||||
|
||||
}else{
|
||||
|
||||
$data = array(
|
||||
'SportsId' => trim($sportName),
|
||||
'TemplateCode' => $templateCode,
|
||||
//'Thumbnail' => $thumbnail,
|
||||
'TemplateName' => $templateName,
|
||||
'TemplateType' => trim($templateType),
|
||||
'Trim' => $numberOfTrims,
|
||||
'PatternId' => $getSkins
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$i = $m->updateNewTemplate($data, $templateCode);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (array_key_exists('svgJerseyFront', $post)) {
|
||||
//echo 'meron jerset front';
|
||||
|
||||
$svgName = $request->file('svgJerseyFront')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
|
||||
$Templatedata = array(
|
||||
'Type' => 'Jersey',
|
||||
'Side' => 'Front',
|
||||
'Path' => $svgThumbnail
|
||||
);
|
||||
|
||||
$i = $m->updateTemplatePaths($Templatedata, $post['id_svgJerseyFront']);
|
||||
if($i){
|
||||
$request->file('svgJerseyFront')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
//echo 'image move success';
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('svgJerseyBack', $post)) {
|
||||
|
||||
$svgName = $request->file('svgJerseyBack')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
|
||||
$Templatedata = array(
|
||||
'Type' => 'Jersey',
|
||||
'Side' => 'Back',
|
||||
'Path' => $svgThumbnail
|
||||
);
|
||||
$i = $m->updateTemplatePaths($Templatedata, $post['id_svgJerseyBack']);
|
||||
if($i){
|
||||
|
||||
$request->file('svgJerseyBack')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('svgShortRight', $post)) {
|
||||
$svgName = $request->file('svgShortRight')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
|
||||
$Templatedata = array(
|
||||
'Type' => 'Shorts',
|
||||
'Side' => 'Right',
|
||||
'Path' => $svgThumbnail
|
||||
);
|
||||
|
||||
$i = $m->updateTemplatePaths($Templatedata, $post['id_svgShortRight']);
|
||||
if($i){
|
||||
$request->file('svgShortRight')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('svgShortLeft', $post)) {
|
||||
$svgName = $request->file('svgShortLeft')->getClientOriginalName();
|
||||
$svgThumbnail = "uniform-templates/".$templateCode."/DISPLAY/".$svgName;
|
||||
|
||||
$Templatedata = array(
|
||||
'Type' => 'Shorts',
|
||||
'Side' => 'Left',
|
||||
'Path' => $svgThumbnail
|
||||
);
|
||||
|
||||
$i = $m->updateTemplatePaths($Templatedata, $post['id_svgShortLeft']);
|
||||
if($i){
|
||||
$request->file('svgShortLeft')->move(
|
||||
base_path() . '/public/images/uniform-templates/'.$templateCode. '/DISPLAY' , $svgName
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa fa-check"></i> Success!</h4>
|
||||
Template is successfully updated.
|
||||
</div>';
|
||||
}
|
||||
|
||||
}
|
||||
36
app/Http/Controllers/WelcomeController.php
Normal file
36
app/Http/Controllers/WelcomeController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
class WelcomeController extends Controller {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Welcome Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller renders the "marketing page" for the application and
|
||||
| is configured to only allow guests. Like most of the other sample
|
||||
| controllers, you are free to modify or remove it as you desire.
|
||||
|
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application welcome screen to the user.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('welcome');
|
||||
}
|
||||
|
||||
}
|
||||
16
app/Http/Controllers/cliparts/ClipartsController.php
Normal file
16
app/Http/Controllers/cliparts/ClipartsController.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php namespace App\Http\Controllers\cliparts;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ClipartsController extends Controller {
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('cliparts.index');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1000
app/Http/Controllers/designer/DesignerController.php
Normal file
1000
app/Http/Controllers/designer/DesignerController.php
Normal file
File diff suppressed because it is too large
Load Diff
256
app/Http/Controllers/paypal/PaypalController.php
Normal file
256
app/Http/Controllers/paypal/PaypalController.php
Normal file
@@ -0,0 +1,256 @@
|
||||
<?php namespace App\Http\Controllers\paypal;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Paypal;
|
||||
use App\Models\teamstore\TeamStoreModel;
|
||||
use App\Models\paypal\PayPalModel;
|
||||
use Auth;
|
||||
use Session;
|
||||
use Redirect;
|
||||
|
||||
|
||||
class PaypalController extends Controller {
|
||||
|
||||
private $_apiContext;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_apiContext = PayPal::ApiContext(
|
||||
config('services.paypal.client_id'),
|
||||
config('services.paypal.secret'));
|
||||
|
||||
|
||||
$this->_apiContext->setConfig(array(
|
||||
'mode' => 'sandbox',
|
||||
'service.EndPoint' => 'https://api.sandbox.paypal.com',
|
||||
'http.ConnectionTimeOut' => 30,
|
||||
'log.LogEnabled' => true,
|
||||
'log.FileName' => storage_path('logs/paypal.log'),
|
||||
'log.LogLevel' => 'FINE'
|
||||
));
|
||||
|
||||
// live
|
||||
// $this->_apiContext->setConfig(array(
|
||||
// 'mode' => 'live',
|
||||
// 'service.EndPoint' => 'https://api.paypal.com',
|
||||
// 'http.ConnectionTimeOut' => 30,
|
||||
// 'log.LogEnabled' => true,
|
||||
// 'log.FileName' => storage_path('logs/paypal.log'),
|
||||
// 'log.LogLevel' => 'FINE'
|
||||
// ));
|
||||
}
|
||||
|
||||
|
||||
public function payPremium()
|
||||
{
|
||||
return view('payPremium');
|
||||
}
|
||||
|
||||
|
||||
public function getCheckout(Request $request)
|
||||
{
|
||||
|
||||
if(Auth::guest()){
|
||||
|
||||
Session::flash('msg', 'Please login to proceed.');
|
||||
return Redirect::back();
|
||||
}
|
||||
|
||||
$payer = PayPal::Payer();
|
||||
$payer->setPaymentMethod('paypal');
|
||||
|
||||
|
||||
|
||||
$m = new TeamStoreModel;
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
|
||||
$items = $m->myCart($cartKey);
|
||||
$getSubtotal = $m->getSubtotal($cartKey);
|
||||
|
||||
// var_dump($getSubtotal[0]->Subtotal);
|
||||
|
||||
$order_subtotal = $getSubtotal[0]->Subtotal;
|
||||
$order_grandtotal = $getSubtotal[0]->Subtotal;
|
||||
|
||||
$order_items = array();
|
||||
|
||||
foreach($items as $key => $item){
|
||||
if($item->Order == "Jersey"){
|
||||
|
||||
$itemOrder = " (Jersey Only)";
|
||||
|
||||
}elseif ($item->Order == "Shorts"){
|
||||
|
||||
$itemOrder = " (Shorts Only)";
|
||||
|
||||
}else{
|
||||
$itemOrder = " (w/ Shorts)";
|
||||
}
|
||||
|
||||
// $descriptions = "Name: " . $item->Name . " Number: " . $item->Number . " Size: " . $item->Size;"?"
|
||||
|
||||
$order_items[$key] = PayPal::Item();
|
||||
$order_items[$key]->setName($item->ProductName);
|
||||
$order_items[$key]->setCurrency('USD');
|
||||
$order_items[$key]->setQuantity($item->Quantity);
|
||||
// $order_items[$key]->setDescription($descriptions);
|
||||
$order_items[$key]->setPrice($item->Price);
|
||||
}
|
||||
|
||||
$item_list = PayPal::ItemList();
|
||||
$item_list->setItems($order_items);
|
||||
|
||||
$amount_details = PayPal::Details();
|
||||
$amount_details->setSubtotal($order_subtotal);
|
||||
|
||||
$amount = PayPal::Amount();
|
||||
$amount->setCurrency('USD');
|
||||
$amount->setDetails($amount_details);
|
||||
$amount->setTotal($order_grandtotal);
|
||||
|
||||
$transaction = PayPal::Transaction();
|
||||
$transaction->setAmount($amount);
|
||||
$transaction->setItemList($item_list);
|
||||
$transaction->setDescription('Your transaction description');
|
||||
$transaction->setInvoiceNumber(date('Y') . '-' . uniqid());
|
||||
|
||||
$redirectUrls = PayPal:: RedirectUrls();
|
||||
$redirectUrls->setReturnUrl(route('getDone'));
|
||||
$redirectUrls->setCancelUrl(route('getCancel'));
|
||||
|
||||
|
||||
$payment = PayPal::Payment();
|
||||
$payment->setIntent('sale');
|
||||
$payment->setPayer($payer);
|
||||
$payment->setRedirectUrls($redirectUrls);
|
||||
$payment->setTransactions(array($transaction));
|
||||
|
||||
|
||||
$response = $payment->create($this->_apiContext);
|
||||
$redirectUrl = $response->links[1]->href;
|
||||
|
||||
|
||||
return redirect()->to( $redirectUrl );
|
||||
}
|
||||
|
||||
public function getDoneTest()
|
||||
{
|
||||
// $paymentId= "PAY-66Y799521H279203PLOP2X4Y";
|
||||
// $payment = PayPal::getById($paymentId, $this->_apiContext);
|
||||
|
||||
// $obj = json_decode($payment);
|
||||
// // var_dump($obj);
|
||||
|
||||
// $total = $obj->transactions[0]->amount->total;
|
||||
// $currency = $obj->transactions[0]->amount->currency;
|
||||
// $invoice_number = $obj->transactions[0]->invoice_number;
|
||||
|
||||
// return view('paypal.get_done')
|
||||
// ->with('currency', $currency)
|
||||
// ->with('total', $total);
|
||||
// try {
|
||||
// $invoice = PayPal::Invoice();
|
||||
// echo $number = $invoice->generateNumber($this->_apiContext);
|
||||
// } catch (Exception $ex) {
|
||||
// echo $ex;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getDone(Request $request)
|
||||
{
|
||||
$id = $request->get('paymentId');
|
||||
$token = $request->get('token');
|
||||
$payer_id = $request->get('PayerID');
|
||||
|
||||
|
||||
$payment = PayPal::getById($id, $this->_apiContext);
|
||||
|
||||
$paymentExecution = PayPal::PaymentExecution();
|
||||
|
||||
$paymentExecution->setPayerId($payer_id);
|
||||
$executePayment = $payment->execute($paymentExecution, $this->_apiContext);
|
||||
|
||||
// print_r($executePayment);
|
||||
// if ($executePayment->getState() == 'approved') {
|
||||
|
||||
// /** it's all right **/
|
||||
// /** Here Write your database logic like that insert record or value in database if you want **/
|
||||
|
||||
// // \Session::put('success','Payment success');
|
||||
// // return Redirect::route('paywithpaypal');
|
||||
// echo 'Payment success';
|
||||
// }
|
||||
$obj = json_decode($executePayment);
|
||||
|
||||
$total = $obj->transactions[0]->amount->total;
|
||||
$currency = $obj->transactions[0]->amount->currency;
|
||||
$invoice_number = $obj->transactions[0]->invoice_number;
|
||||
|
||||
// var_dump($obj->transactions[0]->amount);
|
||||
/// end paypal codes
|
||||
|
||||
$paypal_model = new PayPalModel;
|
||||
$m = new TeamStoreModel;
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$items = $m->myCart($cartKey); // item from cart_tmp
|
||||
$getSubtotal = $m->getSubtotal($cartKey);
|
||||
|
||||
$payment_details = array(
|
||||
'UserId' => $userId,
|
||||
'CartKey' => $cartKey,
|
||||
'PaymentId' => $id,
|
||||
'Token' => $token,
|
||||
'PayerId' => $payer_id,
|
||||
'InvoiceNumber' => $invoice_number,
|
||||
'Currency' => $currency,
|
||||
'Total' => $total
|
||||
);
|
||||
|
||||
$i = $paypal_model->insertToPaypalDetails($payment_details);
|
||||
|
||||
// var_dump($i);
|
||||
|
||||
// foreach($items as $key => $val){
|
||||
// $orders[] = array(
|
||||
// 'Order' => $val->Order,
|
||||
// 'ProductId' => $val->ProductId,
|
||||
// 'CartKey' => $val->CartKey,
|
||||
// 'ProductURL' => $val->ProductURL,
|
||||
// 'TeamName' => $val->TeamName,
|
||||
// 'Name' => $val->Name,
|
||||
// 'Number' => $val->Number,
|
||||
// 'Size' => $val->Size,
|
||||
// 'Price' => $val->Price,
|
||||
// 'Quantity' => $val->Quantity,
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
var_dump($items);
|
||||
|
||||
// $paypal_model->insertToOrders($items); // insert to orders table
|
||||
|
||||
|
||||
// $request->session()->forget('cartkey'); // clear session for cartkey
|
||||
|
||||
// return view('paypal.get_done')
|
||||
// ->with('currency', $currency)
|
||||
// ->with('total', $total);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getCancel()
|
||||
{
|
||||
return redirect()->route('cart');
|
||||
}
|
||||
|
||||
}
|
||||
377
app/Http/Controllers/teamstore/TeamStoreController.php
Normal file
377
app/Http/Controllers/teamstore/TeamStoreController.php
Normal file
@@ -0,0 +1,377 @@
|
||||
<?php namespace App\Http\Controllers\teamstore;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Auth;
|
||||
use App\Models\teamstore\TeamStoreModel;
|
||||
use App\Models\user\UserModel;
|
||||
use Mail;
|
||||
|
||||
|
||||
class TeamStoreController extends Controller {
|
||||
|
||||
public function index(Request $request, $teamStoreURL)
|
||||
{
|
||||
// var_dump($teamStoreURL);
|
||||
$m = new TeamStoreModel;
|
||||
$store_array = $m->selectTeamStore('StoreUrl', $teamStoreURL);
|
||||
$product_array = $m->selectTeamStoreProducts('TeamStoreId', $store_array[0]->Id);
|
||||
$user_role = '';
|
||||
|
||||
if (Auth::check()){
|
||||
$user_role = Auth::user()->role;
|
||||
$store_id = Auth::user()->store_id;
|
||||
}
|
||||
|
||||
// if($request->session()->get('teamstore_data_array') == null){
|
||||
// if($store_id != $store_array[0]->Id){
|
||||
// return redirect()->back();
|
||||
// }
|
||||
// }else{
|
||||
|
||||
// if($user_role != "store_owner"){
|
||||
// if($request->session()->get('teamstore_data_array')[0]->StoreUrl != $store_array[0]->StoreUrl){
|
||||
// return redirect()->back();
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
foreach ($product_array as $p => $pr_arr) {
|
||||
|
||||
$thumbnails_array = $m->getProductThumbnails($pr_arr->Id);
|
||||
foreach ($thumbnails_array as $t => $thumb) {
|
||||
|
||||
if($thumb->ImageClass == 'custom'){
|
||||
$displayThumbnails = $thumb->Image;
|
||||
break;
|
||||
}
|
||||
|
||||
if($thumb->ImageClass == 'active'){
|
||||
$displayThumbnails = $thumb->Image;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$thumbnails[] = array(
|
||||
'folder' => $store_array[0]->ImageFolder,
|
||||
'product_id' => $pr_arr->Id,
|
||||
'thumb' => $displayThumbnails
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
// var_dump($thumbnails);
|
||||
return view('teamstore-sublayouts.index')
|
||||
->with('store_array', $store_array)
|
||||
->with('product_array', $product_array)
|
||||
->with('thumbnails', $thumbnails);
|
||||
}
|
||||
|
||||
public function storelist()
|
||||
{
|
||||
|
||||
$m = new TeamStoreModel;
|
||||
$stores_array = $m->selectAllTeamStore();
|
||||
|
||||
return view('teamstore-sublayouts.stores')
|
||||
->with('stores_array', $stores_array);
|
||||
|
||||
|
||||
|
||||
}
|
||||
public function checkTeamStorePassword(Request $request)
|
||||
{
|
||||
$m = new TeamStoreModel;
|
||||
$post = $request->all();
|
||||
$store_array = $m->selectTeamStore('Password', $post['password']);
|
||||
|
||||
if($store_array){
|
||||
$request->session()->put('teamstore_data_array', $store_array);
|
||||
return redirect('teamstore/'. $store_array[0]->StoreUrl);
|
||||
|
||||
}else{
|
||||
return redirect()->back()->with('errors', 'Invalid Password.');
|
||||
}
|
||||
|
||||
|
||||
// return view('teamstore-sublayouts.index');
|
||||
}
|
||||
|
||||
private $teams_array;
|
||||
|
||||
public function productDetails($teamStoreURL, $productURL)
|
||||
{
|
||||
$m = new TeamStoreModel;
|
||||
$teams_array = array();
|
||||
$store_array = $m->selectTeamStore('StoreUrl', $teamStoreURL);
|
||||
$product_array = $m->selectTeamStoreProducts('ProductURL', $productURL);
|
||||
// var_dump($product_array);
|
||||
$thumbnails_array = $m->getThumbnails($product_array[0]->Id);
|
||||
$teams_array = $m->getTeams($product_array[0]->Id);
|
||||
$sizes_array = $m->getSizes();
|
||||
|
||||
return view('teamstore-sublayouts.product-details')
|
||||
->with('store_array', $store_array)
|
||||
->with('product_array', $product_array)
|
||||
->with('thumbnails_array', $thumbnails_array)
|
||||
->with('teams_array', $teams_array)
|
||||
->with('sizes_array', $sizes_array);
|
||||
|
||||
}
|
||||
|
||||
public function login(Request $request)
|
||||
{
|
||||
// [0]->StoreUrl != $store_array[0]->StoreUrl
|
||||
// if($request->session()->get('teamstore_data_array') != null){
|
||||
// return redirect('teamstore/'.$request->session()->get('teamstore_data_array')[0]->StoreUrl);
|
||||
// }else{
|
||||
return view('teamstore-sublayouts.login');
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public function clearSession(Request $request)
|
||||
{
|
||||
$request->session()->forget('teamstore_data_array');
|
||||
return redirect("{{ url('/') }}");
|
||||
}
|
||||
|
||||
public function addNewRow(Request $request)
|
||||
{
|
||||
$post = $request->all();
|
||||
$itemCount = $post['itemCount'];
|
||||
$cssValue = $post['jersey_chk'];
|
||||
$product_id = $post['product_id'];
|
||||
$classname = "row" . $itemCount;
|
||||
|
||||
$m = new TeamStoreModel;
|
||||
$teams_array = array();
|
||||
$teams_array = $m->getTeams($product_id);
|
||||
$sizes_array = $m->getSizes();
|
||||
// var_dump($teams_array);
|
||||
?>
|
||||
<tr class="<?php echo $classname; ?>">
|
||||
<td class="td-hide" style="<?php echo $cssValue; ?>">
|
||||
<input type="text" class="form-control input-sm capitalizeText cls-uniformName" name="uniformName[]" placeholder="i.e John Doe" data-error="#err-uniformName<?php echo $itemCount ?>" required >
|
||||
<span id="err-uniformName<?php echo $itemCount ?>" style="color: #dd4b39"></span>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control input-sm cls-uniformTeam" name="uniformTeam[]" data-error="#err-uniformTeam<?php echo $itemCount ?>" require>
|
||||
<option value="">Select Team</option>
|
||||
<?php
|
||||
|
||||
foreach($teams_array as $team){
|
||||
?><option value="<?php echo $team->Team ?>"><?php echo $team->Team ?></option><?php
|
||||
}
|
||||
|
||||
?>
|
||||
<option value="others">Others</option>
|
||||
</select>
|
||||
<span id="err-uniformTeam<?php echo $itemCount ?>" style="color: #dd4b39"></span>
|
||||
</td>
|
||||
<td>
|
||||
<div id="selectOptionNumber1">
|
||||
<select class="form-control input-sm cls-uniformNumber" name="uniformNumber[]" data-error="#err-uniformNumber<?php echo $itemCount ?>" require >
|
||||
<option value="">Select Number</option>
|
||||
<?php
|
||||
for($i = 0 ; $i < 100 ; $i++){
|
||||
?><option value="<?php echo $i ?>"><?php echo $i ?></option><?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<span id="err-uniformNumber<?php echo $itemCount ?>" style="color: #dd4b39"></span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<div id="fetchSizes">
|
||||
<select class="form-control input-sm cls-uniformSize" name="uniformSize[]" data-error="#err-uniformSize<?php echo $itemCount ?>" require>
|
||||
<option value="">Select Size</option>
|
||||
<?php
|
||||
foreach($sizes_array as $size){
|
||||
?><option value="<?php echo $size->Size ?>"><?php echo $size->Size ?></option><?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<span id="err-uniformSize<?php echo $itemCount ?>" style="color: #dd4b39"></span>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="changeToRemoveBtn">
|
||||
<button type="button" class="btn btn-danger btn-sm removeRow" data-toggle="tooltip" title="Remove"><i class="fa fa-remove" aria-hidden="true"></i></button>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="addnew-btn-tbl-row">
|
||||
<td colspan="5" ><button type="button" id="addNewRow" class="btn btn-success btn-sm pull-right" data-toggle="tooltip" title="Add Another"><i class="fa fa-plus" aria-hidden="true"></i> Add Row</button></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function addToCart(Request $request)
|
||||
{
|
||||
$post = $request->all();
|
||||
$m = new TeamStoreModel;
|
||||
|
||||
|
||||
$product_id = $post['product_id'];
|
||||
$store_url = $post['store_url'];
|
||||
|
||||
if($request->session()->has('cartkey')){
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
}else{
|
||||
$request->session()->put('cartkey', sha1(time() . str_random(6)));
|
||||
$cartKey = $cartKey = $request->session()->get('cartkey');
|
||||
}
|
||||
|
||||
|
||||
$product_array = $m->selectTeamStoreProducts('Id', $product_id);
|
||||
$ProductPrice = $product_array[0]->ProductPrice;
|
||||
$ProductURL = $product_array[0]->ProductURL;
|
||||
$product_form = $product_array[0]->ProductForm;
|
||||
$design_code = $product_array[0]->DesignCode;
|
||||
$product_name = $product_array[0]->ProductName;
|
||||
|
||||
if($product_form == "jersey-and-shorts-form"){
|
||||
$order_names = $post['order_names'];
|
||||
$order_number = $post['order_number'];
|
||||
$order_jersey_size = $post['order_jersey_size'];
|
||||
$order_shorts_size = $post['order_shorts_size'];
|
||||
|
||||
foreach($order_names as $key => $val){
|
||||
|
||||
if($order_jersey_size[$key] == "none" || $order_shorts_size[$key] == "none"){
|
||||
$final_price = $ProductPrice / 2;
|
||||
}else{
|
||||
$final_price = $ProductPrice;
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'ProductId' => $product_id,
|
||||
'StoreURL' => $store_url,
|
||||
'FormUsed' => $product_form,
|
||||
'CartKey' => $cartKey,
|
||||
'DesignCode' => $design_code,
|
||||
'ProductURL' => $ProductURL,
|
||||
'ProductName' => $product_name,
|
||||
'Name' => $order_names[$key],
|
||||
'Number' => $order_number[$key],
|
||||
'JerseySize' => $order_jersey_size[$key],
|
||||
'ShortsSize' => $order_shorts_size[$key],
|
||||
'Price' => $final_price,
|
||||
'Quantity' => 1
|
||||
);
|
||||
}
|
||||
}elseif($product_form == "tshirt-form"){
|
||||
|
||||
$items[] = array(
|
||||
'ProductId' => $product_id,
|
||||
'StoreURL' => $store_url,
|
||||
'FormUsed' => $product_form,
|
||||
'CartKey' => $cartKey,
|
||||
'DesignCode' => $design_code,
|
||||
'ProductURL' => $ProductURL,
|
||||
'ProductName' => $product_name,
|
||||
'Size' => $post['uniformSize'],
|
||||
'Price' => $ProductPrice,
|
||||
'Quantity' => $post['quantity']
|
||||
);
|
||||
}elseif($product_form == "quantity-form"){
|
||||
|
||||
$items[] = array(
|
||||
'ProductId' => $product_id,
|
||||
'StoreURL' => $store_url,
|
||||
'FormUsed' => $product_form,
|
||||
'CartKey' => $cartKey,
|
||||
'DesignCode' => $design_code,
|
||||
'ProductURL' => $ProductURL,
|
||||
'ProductName' => $product_name,
|
||||
'Price' => $ProductPrice,
|
||||
'Quantity' => $post['quantity']
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$i = $m->insertToCart($items);
|
||||
|
||||
if($i){
|
||||
return response()->json(array(
|
||||
'success' => true
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
return response()->json(array(
|
||||
'success' => false,
|
||||
'message' => "Something went wrong. Please refresh the page."
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function cart(Request $request){
|
||||
$m = new TeamStoreModel;
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
|
||||
$items = $m->myCart($cartKey);
|
||||
$getSubtotal = $m->getSubtotal($cartKey);
|
||||
$items_group = $m->myCartGroup($cartKey);
|
||||
|
||||
// var_dump($items_group);
|
||||
return view('sublayouts.cart')
|
||||
->with('item_group', $items_group)
|
||||
->with('row', $items)
|
||||
->with('getSubtotal', $getSubtotal);
|
||||
}
|
||||
|
||||
public function checkout(Request $request)
|
||||
{
|
||||
$m = new TeamStoreModel;
|
||||
$cartKey = $request->session()->get('cartkey');
|
||||
|
||||
$usermodel = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$array_address_book = $usermodel->selectAddresBook('UserId', $userId);
|
||||
|
||||
// var_dump($array_address_book);
|
||||
|
||||
$items = $m->myCart($cartKey);
|
||||
|
||||
$getSubtotal = $m->getSubtotal($cartKey);
|
||||
|
||||
return view('sublayouts.checkout')
|
||||
->with('row', $items)
|
||||
->with('getSubtotal', $getSubtotal)
|
||||
->with('array_address_book', $array_address_book);
|
||||
|
||||
}
|
||||
|
||||
public function mail()
|
||||
{
|
||||
// $user = User::find(1)->toArray();
|
||||
|
||||
// var_dump($user);
|
||||
|
||||
// Mail::send('emails.mailExample', $user, function($message) use ($user) {
|
||||
// $message->to($user->email);
|
||||
// $message->subject('E-Mail Example');
|
||||
// });
|
||||
|
||||
|
||||
// dd('Mail Send Successfully');
|
||||
Mail::raw('Text to e-mail', function($message)
|
||||
{
|
||||
$message->from('us@example.com', 'Laravel');
|
||||
|
||||
$message->to('frank.begornia@yahoo.com')->subject('sample email');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
442
app/Http/Controllers/user/UserController.php
Normal file
442
app/Http/Controllers/user/UserController.php
Normal file
@@ -0,0 +1,442 @@
|
||||
<?php namespace App\Http\Controllers\user;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Auth;
|
||||
use App\Models\user\UserModel;
|
||||
use App\Models\teamstore\TeamStoreModel;
|
||||
use App\Models\MainModel;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Paypal;
|
||||
use View;
|
||||
use Mail;
|
||||
|
||||
class UserController extends Controller {
|
||||
|
||||
// private $_apiContext;
|
||||
|
||||
// public function __construct()
|
||||
// {
|
||||
// $this->_apiContext = PayPal::ApiContext(
|
||||
// config('services.paypal.client_id'),
|
||||
// config('services.paypal.secret'));
|
||||
|
||||
|
||||
// $this->_apiContext->setConfig(array(
|
||||
// 'mode' => 'sandbox',
|
||||
// 'service.EndPoint' => 'https://api.sandbox.paypal.com',
|
||||
// 'http.ConnectionTimeOut' => 30,
|
||||
// 'log.LogEnabled' => true,
|
||||
// 'log.FileName' => storage_path('logs/paypal.log'),
|
||||
// 'log.LogLevel' => 'FINE'
|
||||
// ));
|
||||
|
||||
|
||||
// // view()->share('datas', [1, 2, 3]);
|
||||
|
||||
// }
|
||||
|
||||
//
|
||||
public function index(){
|
||||
|
||||
return view('user-layouts.index');
|
||||
|
||||
}
|
||||
|
||||
public function addressBook(){
|
||||
$m = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$array_address_book = $m->selectAddresBook('UserId', $userId);
|
||||
|
||||
return view('user-layouts.address_book')
|
||||
->with('array_address_book', $array_address_book);
|
||||
|
||||
}
|
||||
|
||||
public function createAddressBook(){
|
||||
|
||||
return view('user-layouts.create_address_book');
|
||||
|
||||
}
|
||||
|
||||
public function saveAddressBook(Request $request){
|
||||
$post = $request->all();
|
||||
$m = new UserModel;
|
||||
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$data = array(
|
||||
'UserId' => $userId,
|
||||
'Fullname' => $post['fullname'],
|
||||
'ContactNumber' => $post['mobilenumber'],
|
||||
'OtherNotes' => $post['othernotes'],
|
||||
'Address' => $post['address'],
|
||||
'State' => $post['state'],
|
||||
'City' => $post['city'],
|
||||
'ZipCode' => $post['zipcode']
|
||||
);
|
||||
|
||||
echo $i = $m->insertAddressBook($data);
|
||||
|
||||
}
|
||||
|
||||
public function editAddressBook($id){
|
||||
$m = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$array_address_book = $m->selectAddresBook('Id', $id);
|
||||
|
||||
if($array_address_book[0]->UserId != $userId){
|
||||
return redirect('user/address-book');
|
||||
}
|
||||
|
||||
return view('user-layouts.edit_address_book')
|
||||
->with('array_address_book', $array_address_book);
|
||||
|
||||
}
|
||||
|
||||
public function updateAddressBook(Request $request){
|
||||
$post = $request->all();
|
||||
$m = new UserModel;
|
||||
|
||||
$userId = Auth::user()->id;
|
||||
$id = $post['id'];
|
||||
|
||||
$data = array(
|
||||
'UserId' => $userId,
|
||||
'Fullname' => $post['fullname'],
|
||||
'ContactNumber' => $post['mobilenumber'],
|
||||
'OtherNotes' => $post['othernotes'],
|
||||
'Address' => $post['address'],
|
||||
'State' => $post['state'],
|
||||
'City' => $post['city'],
|
||||
'ZipCode' => $post['zipcode']
|
||||
);
|
||||
|
||||
echo $i = $m->saveUpdateAddressBook($data, $id);
|
||||
|
||||
}
|
||||
|
||||
public function profile(){
|
||||
$m = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$array_profile_info = $m->selectProfileInfo($userId);
|
||||
return view('user-layouts.profile')
|
||||
->with('array_profile_info', $array_profile_info);
|
||||
}
|
||||
|
||||
public function editProfile(){
|
||||
$m = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$array_profile_info = $m->selectProfileInfo($userId);
|
||||
return view('user-layouts.edit_profile')
|
||||
->with('array_profile_info', $array_profile_info);
|
||||
|
||||
}
|
||||
|
||||
public function updateProfile(Request $request){
|
||||
$post = $request->all();
|
||||
$m = new UserModel;
|
||||
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$user_logins_data = array(
|
||||
'name' => $post['fullname'],
|
||||
'email' => $post['email']
|
||||
);
|
||||
|
||||
$user_info_data = array(
|
||||
'UserId' => $userId,
|
||||
'ContactNumber' => $post['contactnumber'],
|
||||
'Gender' => $post['gender'],
|
||||
'Birthday' => date('Y-m-d', strtotime($post['birthday']))
|
||||
);
|
||||
|
||||
$i = $m->saveUpdateUserLogins($user_logins_data, $userId);
|
||||
$i1 = $m->saveUpdateUserInfo($user_info_data, $userId);
|
||||
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
public function changePassword(){
|
||||
return view('user-layouts.change_password');
|
||||
}
|
||||
|
||||
public function updatePassword(Request $request){
|
||||
$post = $request->all();
|
||||
$m = new UserModel;
|
||||
$c_password = Auth::user()->password;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
if(!(Hash::check($post['current_password'], $c_password))){
|
||||
$message = "Your current password does not matches with the password you provided. Please try again.";
|
||||
return $message;
|
||||
}
|
||||
|
||||
if(strcmp($post['current_password'], $post['new_password']) == 0){
|
||||
//Current password and new password are same
|
||||
$message = "New Password cannot be same as your current password. Please choose a different password.";
|
||||
return $message;
|
||||
}
|
||||
|
||||
if ($post['new_password'] != $post['con_new_password']) {
|
||||
// The passwords matches
|
||||
$message = "Password confirmation and New Password must match. Please try again.";
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
||||
$i = $m->saveUpdatePassword(bcrypt($post['new_password']) , $userId);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
public function orders(){
|
||||
$m = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
$array_payment_details = $m->selectPaymentDetails($userId);
|
||||
|
||||
// var_dump($array_payment_details);
|
||||
|
||||
// var_dump($array_payment_details);
|
||||
return view('user-layouts.orders')->with('array_payment_details', $array_payment_details);
|
||||
}
|
||||
|
||||
|
||||
public function myDesigns(){
|
||||
$m = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$array_client_designs = $m->selectClientDesigns($userId);
|
||||
// var_dump($array_client_designs);
|
||||
return view('user-layouts.my-design')->with('array_client_designs', $array_client_designs);
|
||||
}
|
||||
|
||||
public function viewDesign($designCode){
|
||||
$m = new UserModel;
|
||||
$newMainModel = new MainModel;
|
||||
$userId = Auth::user()->id;
|
||||
$array_client_designs = $m->selectClientDesignsbyCode($designCode);
|
||||
|
||||
// check if its your design
|
||||
if($userId != $array_client_designs[0]->ClientId){
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$array_template_paths = $m->selectTemplatePaths('TemplateCode', $array_client_designs[0]->TemplateCode);
|
||||
$array_cat_name = $newMainModel->selectCategoryName($array_client_designs[0]->TemplateCode);
|
||||
|
||||
return view('user-layouts.view-design')
|
||||
->with('array_client_designs', $array_client_designs)
|
||||
->with('array_template_paths', $array_template_paths)
|
||||
->with('array_cat_name', $array_cat_name);
|
||||
}
|
||||
|
||||
public function updateDesignDetails(Request $request){
|
||||
$post = $request->all();
|
||||
$m = new UserModel;
|
||||
|
||||
$design_name = $post['design_name'];
|
||||
$design_code = $post['design_code'];
|
||||
|
||||
$client_design_data = array(
|
||||
'DesignName' => $design_name
|
||||
);
|
||||
|
||||
$i = $m->updateClientDesign($client_design_data, $design_code);
|
||||
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
public function store(){
|
||||
$m = new UserModel;
|
||||
$userRole = Auth::user()->role;
|
||||
$array_store_info = array();
|
||||
|
||||
if($userRole == "store_owner"){
|
||||
$storeId = Auth::user()->store_id;
|
||||
|
||||
$array_store_info = $m->selectStoreInfo($storeId);
|
||||
|
||||
return redirect('teamstore/'. $array_store_info[0]->StoreUrl);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function storeItems(){
|
||||
$thumbnails = array();
|
||||
$newUserModel = new UserModel;
|
||||
$newTeamStoreModel = new TeamStoreModel;
|
||||
|
||||
$user_role = Auth::user()->role;
|
||||
$store_id = Auth::user()->store_id;
|
||||
|
||||
$store_array = $newTeamStoreModel->selectTeamStore('Id', $store_id);
|
||||
$product_array = $newTeamStoreModel->selectTeamStoreProducts('TeamStoreId', $store_id);
|
||||
|
||||
foreach ($product_array as $p => $pr_arr) {
|
||||
|
||||
$thumbnails_array = $newTeamStoreModel->getProductThumbnails($pr_arr->Id);
|
||||
foreach ($thumbnails_array as $t => $thumb) {
|
||||
|
||||
if($thumb->ImageClass == 'custom'){
|
||||
$displayThumbnails = $thumb->Image;
|
||||
break;
|
||||
}
|
||||
|
||||
if($thumb->ImageClass == 'active'){
|
||||
$displayThumbnails = $thumb->Image;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$thumbnails[] = array(
|
||||
'folder' => $store_array[0]->ImageFolder,
|
||||
'product_id' => $pr_arr->Id,
|
||||
'thumb' => $displayThumbnails
|
||||
);
|
||||
}
|
||||
|
||||
// var_dump($thumbnails);
|
||||
return view('user-layouts.store_items')->with('store_array', $store_array)
|
||||
->with('product_array', $product_array)
|
||||
->with('thumbnails', $thumbnails);
|
||||
}
|
||||
|
||||
public function viewStoreItem($url){
|
||||
$product_array = array();
|
||||
$newUserModel = new UserModel;
|
||||
$newTeamStoreModel = new TeamStoreModel;
|
||||
|
||||
$product_array = $newTeamStoreModel->selectTeamStoreProducts('ProductURL', $url);
|
||||
$thumbnails_array = $newTeamStoreModel->getThumbnails($product_array[0]->Id);
|
||||
// var_dump($product_array);
|
||||
return view('user-layouts.view-store-item')->with('product_array', $product_array)
|
||||
->with('thumbnails_array', $thumbnails_array);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function storeItemUpdate(Request $request){
|
||||
$post = $request->all();
|
||||
$newTeamStoreModel = new TeamStoreModel;
|
||||
|
||||
$item_url = $post['item_url'];
|
||||
$data = array(
|
||||
'ProductName' => $post['itemName'],
|
||||
'ProductPrice' => str_replace('$ ', '', $post['item_price']),
|
||||
'ProductDescription' => $post['itemDescription'],
|
||||
'PrivacyStatus' => $post['item_privacy']
|
||||
);
|
||||
|
||||
$i = $newTeamStoreModel->updateStoreItem($data, $item_url);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
public function storeSetting()
|
||||
{
|
||||
return view('user-layouts.store_setting');
|
||||
}
|
||||
|
||||
public function emailVerify()
|
||||
{
|
||||
$m = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
$email_is_verified = Auth::user()->email_is_verified;
|
||||
|
||||
if($email_is_verified == 0){
|
||||
$array_profile_info = $m->selectProfileInfo($userId);
|
||||
return view('user-layouts.email_verify')
|
||||
->with('array_profile_info', $array_profile_info);
|
||||
}
|
||||
|
||||
return redirect('user/profile');
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function resendVericationCode(Request $request){
|
||||
$post = $request->all();
|
||||
$random_hash = rand(1000, 9999);
|
||||
|
||||
$newUserModel = new UserModel;
|
||||
|
||||
$emailDetails = [
|
||||
'receiver' => $post['email'],
|
||||
'subject' => 'CREW Sportswear Email Verification Code',
|
||||
'verification_code' => $random_hash
|
||||
];
|
||||
|
||||
Mail::send('emails.resend_code', $emailDetails, function($message) use ($emailDetails) {
|
||||
|
||||
$message->from('no-reply@crewsportswear.com', 'CREW Sportswear');
|
||||
$message->to($emailDetails['receiver'])->subject('CREW Sportswear Email Verification Code');
|
||||
|
||||
});
|
||||
|
||||
if( count(Mail::failures()) > 0 ) {
|
||||
|
||||
echo '0';
|
||||
|
||||
}else{
|
||||
$data = array(
|
||||
'EmailAddress' => $post['email'],
|
||||
'VerCode' => $random_hash
|
||||
);
|
||||
|
||||
$i = $newUserModel->saveResendCode($data);
|
||||
echo $i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function verifyCode(Request $request){
|
||||
$post = $request->all();
|
||||
|
||||
$verification_code = $post['verification_code'];
|
||||
$userEmail = Auth::user()->email;
|
||||
|
||||
$newUserModel = new UserModel;
|
||||
$userId = Auth::user()->id;
|
||||
|
||||
$data = array(
|
||||
'EmailAddress' => $userEmail,
|
||||
'Code' => $verification_code
|
||||
);
|
||||
|
||||
$i = $newUserModel->validateCode($data);
|
||||
// var_dump($i);
|
||||
|
||||
if($i){
|
||||
|
||||
$user_logins_data = array(
|
||||
'email_is_verified' => 1
|
||||
);
|
||||
|
||||
$newUserModel->saveUpdateUserLogins($user_logins_data, $userId);
|
||||
|
||||
return response()->json(array(
|
||||
'success' => true,
|
||||
'message'=>'Your email is successfully verified.'
|
||||
));
|
||||
|
||||
}else{
|
||||
return response()->json(array(
|
||||
'success' => false,
|
||||
'message'=>'Invalid verification code.'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
35
app/Http/Kernel.php
Normal file
35
app/Http/Kernel.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel {
|
||||
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
|
||||
'Illuminate\Cookie\Middleware\EncryptCookies',
|
||||
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
|
||||
'Illuminate\Session\Middleware\StartSession',
|
||||
'Illuminate\View\Middleware\ShareErrorsFromSession',
|
||||
'App\Http\Middleware\VerifyCsrfToken',
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => 'App\Http\Middleware\Authenticate',
|
||||
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
|
||||
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
|
||||
'teamstoresession' => 'App\Http\Middleware\CheckTeamStorePassword',
|
||||
'admin' => '\App\Http\Middleware\IsAdmin',
|
||||
'normaluser' => '\App\Http\Middleware\IsUser',
|
||||
];
|
||||
|
||||
}
|
||||
50
app/Http/Middleware/Authenticate.php
Normal file
50
app/Http/Middleware/Authenticate.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
|
||||
class Authenticate {
|
||||
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->auth->guest())
|
||||
{
|
||||
if ($request->ajax())
|
||||
{
|
||||
return response('Unauthorized.', 401);
|
||||
}
|
||||
else
|
||||
{
|
||||
return redirect()->guest('auth/login');
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
25
app/Http/Middleware/CheckTeamStorePassword.php
Normal file
25
app/Http/Middleware/CheckTeamStorePassword.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class CheckTeamStorePassword {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (!$request->session()->has('teamstore_data_array')) {
|
||||
// user value cannot be found in session
|
||||
|
||||
// return redirect('/teamstore');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
23
app/Http/Middleware/IsAdmin.php
Normal file
23
app/Http/Middleware/IsAdmin.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Auth;
|
||||
class IsAdmin {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Auth::user() && Auth::user()->role == 'admin') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
}
|
||||
23
app/Http/Middleware/IsUser.php
Normal file
23
app/Http/Middleware/IsUser.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Auth;
|
||||
class IsUser {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (Auth::user() && (Auth::user()->role == 'user' || Auth::user()->role == 'store_owner' )) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
}
|
||||
44
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
44
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class RedirectIfAuthenticated {
|
||||
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->auth->check())
|
||||
{
|
||||
return new RedirectResponse(url('/'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
21
app/Http/Middleware/VerifyCsrfToken.php
Normal file
21
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
|
||||
|
||||
class VerifyCsrfToken extends BaseVerifier {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
return parent::handle($request, $next);
|
||||
}
|
||||
|
||||
}
|
||||
9
app/Http/Requests/Request.php
Normal file
9
app/Http/Requests/Request.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
abstract class Request extends FormRequest {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
161
app/Http/routes.php
Normal file
161
app/Http/routes.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register all of the routes for an application.
|
||||
| It's a breeze. Simply tell Laravel the URIs it should respond to
|
||||
| and give it the controller to call when that URI is requested.
|
||||
|
|
||||
*/
|
||||
|
||||
// Route::get('/', 'WelcomeController@index');
|
||||
|
||||
// Route::get('home', 'HomeController@index');
|
||||
|
||||
Route::controllers([
|
||||
'auth' => 'Auth\AuthController',
|
||||
'password' => 'Auth\PasswordController',
|
||||
]);
|
||||
|
||||
|
||||
Route::get('/', 'MainController@index');
|
||||
Route::get('/sportslist', 'MainController@sports');
|
||||
Route::get('/sports/{url}', 'MainController@templatesCat');
|
||||
Route::get('/sports/{url}/{id}', 'MainController@templatesByCategory');
|
||||
Route::get('/templatelist', 'MainController@fetchTemplates');
|
||||
Route::get('/cartcount', 'MainController@countCart');
|
||||
Route::get('/removeitem/{id}', 'MainController@removeCartItem');
|
||||
|
||||
Route::post('/custom/auth', 'CustomAuthController@authenticate');
|
||||
Route::post('/custom/register', 'CustomAuthController@postRegister');
|
||||
|
||||
|
||||
// Route::get('/cart', 'teamstore\TeamStoreController@cart');
|
||||
|
||||
Route::get('cart', ['as'=>'cart','uses'=>'teamstore\TeamStoreController@cart']);
|
||||
Route::get('/checkout', 'teamstore\TeamStoreController@checkout');
|
||||
Route::get('/mail', 'teamstore\TeamStoreController@mail');
|
||||
|
||||
Route::get('/designer/{templateid}', 'designer\DesignerController@index');
|
||||
|
||||
Route::get('/designer/preview/{designCode}', 'designer\DesignerController@getDesign');
|
||||
Route::post('/designer/a/buy-form', 'designer\DesignerController@buyForm');
|
||||
|
||||
//edit routes//
|
||||
Route::get('/designer/edit/{designCode}', 'designer\DesignerController@editDesign');
|
||||
//end edit routes//
|
||||
|
||||
// CUSTOMIZER DISPLAY
|
||||
Route::post('/designer/a/add-new-row', 'designer\DesignerController@addNewRow');
|
||||
Route::post('/designer/a/save-roster', 'designer\DesignerController@saveRoster');
|
||||
Route::group(['middleware' => ['auth']], function() {
|
||||
|
||||
});
|
||||
//END CUSTOMIZER DISPLAY
|
||||
|
||||
Route::post('/designer/a/gradient-append', 'designer\DesignerController@gradientAppend');
|
||||
Route::post('/designer/a/set-pattern', 'designer\DesignerController@setPattern');
|
||||
Route::post('/designer/a/set-trim-pattern', 'designer\DesignerController@setTrimPattern');
|
||||
Route::post('/designer/a/get-template-default-colors', 'designer\DesignerController@getTemplateDefaultColors');
|
||||
Route::post('/designer/a/get-font-display', 'designer\DesignerController@getFontDisplay');
|
||||
Route::post('/designer/a/get-cliparts', 'designer\DesignerController@getCliparts');
|
||||
Route::post('/designer/a/clipart-properties', 'designer\DesignerController@clipartProperties');
|
||||
Route::post('/designer/a/save-design', 'designer\DesignerController@saveDesign');
|
||||
Route::post('/designer/edit/a/edit-gradient-append', 'designer\DesignerController@editGradientAppend');
|
||||
Route::post('/designer/edit/a/edit-pattern-properties', 'designer\DesignerController@editPatternProperties');
|
||||
Route::post('/designer/edit/a/edit-set-pattern', 'designer\DesignerController@editSetPattern');
|
||||
Route::get('/designer/a/tab-clipart-content', 'designer\DesignerController@tabClipartContent');
|
||||
Route::post('/designer/a/save-design-details', 'designer\DesignerController@saveDesignDetails');
|
||||
|
||||
// teamstore
|
||||
Route::get('/teamstore', 'teamstore\TeamStoreController@login'); // old
|
||||
Route::get('/teamstore', 'teamstore\TeamStoreController@storelist'); // old
|
||||
|
||||
|
||||
// Route::group(['middleware' => 'teamstoresession'], function () {
|
||||
|
||||
Route::get('/teamstore/{storename}', 'teamstore\TeamStoreController@index');
|
||||
Route::get('/teamstore/{storename}/product/{producurl}', 'teamstore\TeamStoreController@productDetails');
|
||||
Route::post('/teamstore/q/addnewrow', 'teamstore\TeamStoreController@addNewRow');
|
||||
Route::post('/teamstore/q/add-to-cart', 'teamstore\TeamStoreController@addToCart');
|
||||
Route::get('/teamstore/q/clearsession', 'teamstore\TeamStoreController@clearSession');
|
||||
|
||||
// });
|
||||
|
||||
Route::post('/teamstore/checkpassword', 'teamstore\TeamStoreController@checkTeamStorePassword');
|
||||
// end teamstore
|
||||
|
||||
// user and store owner
|
||||
Route::group(['middleware' => 'normaluser'], function () {
|
||||
|
||||
Route::get('user', 'user\UserController@index');
|
||||
Route::get('user/address-book', 'user\UserController@addressBook');
|
||||
Route::get('user/address-book/create', 'user\UserController@createAddressBook');
|
||||
Route::post('user/address-book/save', 'user\UserController@saveAddressBook');
|
||||
Route::get('user/address-book/edit/{id}', 'user\UserController@editAddressBook');
|
||||
Route::post('user/address-book/update', 'user\UserController@updateAddressBook');
|
||||
Route::get('user/profile', 'user\UserController@profile');
|
||||
Route::get('user/profile/edit', 'user\UserController@editProfile');
|
||||
Route::post('user/profile/update', 'user\UserController@updateProfile');
|
||||
Route::get('user/profile/change-password', 'user\UserController@changePassword');
|
||||
Route::post('user/profile/update-password', 'user\UserController@updatePassword');
|
||||
Route::get('user/orders', 'user\UserController@orders');
|
||||
Route::get('user/my-designs', 'user\UserController@myDesigns');
|
||||
Route::get('user/my-designs/view/{id}', 'user\UserController@viewDesign');
|
||||
Route::post('user/my-designs/update', 'user\UserController@updateDesignDetails');
|
||||
Route::get('user/store', 'user\UserController@store');
|
||||
Route::get('user/store-items', 'user\UserController@storeItems');
|
||||
Route::get('user/store-items/item/{url}', 'user\UserController@viewStoreItem');
|
||||
Route::post('user/store-items/update', 'user\UserController@storeItemUpdate');
|
||||
Route::get('user/store-settings', 'user\UserController@storeSetting');
|
||||
Route::get('user/email-verify', 'user\UserController@emailVerify');
|
||||
Route::post('user/post/resend-verification', 'user\UserController@resendVericationCode');
|
||||
Route::post('user/post/verify-code', 'user\UserController@verifyCode');
|
||||
});
|
||||
|
||||
|
||||
Route::group(['middleware' => 'admin'], function () {
|
||||
Route::get('admin', function () {
|
||||
return view('sub_pages.index');
|
||||
});
|
||||
|
||||
Route::get('admin/sports/', 'SportsController@displayAllSports');
|
||||
Route::get('admin/sports/add', 'SportsController@displayAddSportPage');
|
||||
Route::post('admin/sports/save', 'SportsController@saveNewSports');
|
||||
Route::get('admin/sports/edit/{sportsname}', 'SportsController@sportsDetails');
|
||||
Route::post('admin/sports/update', 'SportsController@updateSports');
|
||||
Route::get('admin/sports/sportsname', 'SportsController@selectSportsName');
|
||||
|
||||
Route::get('admin/templates/', 'TemplatesController@displayTemplates');
|
||||
Route::post('admin/templates/id/{id}', 'TemplatesController@getTemplates');
|
||||
Route::get('admin/templates/add', 'TemplatesController@displayAddTemplatePage');
|
||||
Route::get('admin/templates/type', 'TemplatesController@getTemplateTypes');
|
||||
Route::get('admin/templates/getlastid', 'TemplatesController@getLastId');
|
||||
Route::post('admin/templates/save', 'TemplatesController@saveNewTemplates');
|
||||
Route::get('admin/templates/edit/{tempcode}', 'TemplatesController@displayEditTemplatePage');
|
||||
Route::post('admin/templates/update', 'TemplatesController@updateTemplate');
|
||||
Route::get('admin/templates/edit/{tempcode}/p-add', 'PrintPatternController@displayAddPrintTemplatePage');
|
||||
|
||||
Route::get('admin/pattern/get', 'PatternsController@getPatterns');
|
||||
Route::post('admin/pattern/get/withvalue', 'PatternsController@getPatternsWithPostValue');
|
||||
|
||||
Route::post('admin/print-template/save', 'PrintPatternController@savePrintPattern');
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Route::group(['middleware' => ['web']], function () {
|
||||
Route::get('payPremium', ['as'=>'payPremium','uses'=>'paypal\PaypalController@payPremium']);
|
||||
Route::get('getCheckout', ['as'=>'getCheckout','uses'=>'paypal\PaypalController@getCheckout']);
|
||||
Route::get('getDone', ['as'=>'getDone','uses'=>'paypal\PaypalController@getDone']);
|
||||
Route::get('getCancel', ['as'=>'getCancel','uses'=>'paypal\PaypalController@getCancel']);
|
||||
Route::get('getDoneTest', ['as'=>'getDoneTest','uses'=>'paypal\PaypalController@getDoneTest']);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
Route::get('cliparts/index', 'cliparts\ClipartsController@index');
|
||||
166
app/Models/MainModel.php
Normal file
166
app/Models/MainModel.php
Normal file
@@ -0,0 +1,166 @@
|
||||
<?php namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class MainModel extends Model {
|
||||
|
||||
//
|
||||
function selectAllSports() // display all data from database
|
||||
{
|
||||
$i = DB::table('sports')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectSportsByURL($url) // display all data from database
|
||||
{
|
||||
$i = DB::table('sports')
|
||||
->where('URL', $url)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectSportsTemplates($id) //
|
||||
{
|
||||
$i = DB::table('templates')->where('SportsId', '=', $id)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectSportsId($url) //
|
||||
{
|
||||
$i = DB::table('sports')->where('URL', '=', $url)->get();
|
||||
$id = $i[0]->Id;
|
||||
|
||||
$k = DB::table('templates')->where('SportsId', '=', $id)
|
||||
->where('IsActive','=', "TRUE")
|
||||
->get();
|
||||
return $k;
|
||||
}
|
||||
|
||||
function selectStates() // display all data from database
|
||||
{
|
||||
$i = DB::table('states')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectAvailableNumbers($id) //
|
||||
{
|
||||
$i = DB::table('orders')->where('TeamId', '=', $id)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectSizes() //
|
||||
{
|
||||
$i = DB::table('sizes')->select('Size')->orderby('Ordering', 'ASC')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectProducts() //
|
||||
{
|
||||
$i = DB::table('products')->orderby('Ordering', 'ASC')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertToCart($data){
|
||||
|
||||
$i = DB::table('cart_tmp')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function cartCount($cartkey){ // count Confirmed attendees
|
||||
|
||||
$i = DB::table('cart_tmp')->where('CartKey', '=', $cartkey)->sum('Quantity');
|
||||
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
function getProduct($ProductURL)
|
||||
{
|
||||
|
||||
$i = DB::table('products')->where('ProductURL', $ProductURL)->first();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function myCart($cartKey){
|
||||
|
||||
if($cartKey != ""){
|
||||
|
||||
$i = DB::table('cart_tmp')->select('cart_tmp.Id', 'cart_tmp.CartKey', 'teams.GradeLevel', 'teams.Team', 'cart_tmp.Name', 'cart_tmp.Number', 'cart_tmp.Size', 'cart_tmp.Quantity', 'products.ProductImage', 'products.ProductName', 'products.ProductPrice', 'products.ProductURL')
|
||||
->leftjoin('products', 'cart_tmp.ProductURL','=','products.ProductURL')
|
||||
->leftjoin('teams', 'cart_tmp.TeamId','=','teams.Id')
|
||||
->where('cart_tmp.CartKey','=',$cartKey)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
||||
function removeItem($id){
|
||||
|
||||
$i = DB::table('cart_tmp')->where('Id', $id)->delete();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertRegistrantInfo($info){
|
||||
|
||||
$i = DB::table('registrant_info')->insert($info);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectPurchaseProduct($cartKey){
|
||||
|
||||
|
||||
$i = DB::table('cart_tmp')->select('cart_tmp.CartKey', 'products.ProductCategory', 'products.ProductImage', 'products.ProductName', 'products.ProductPrice', DB::raw('CONCAT(teams.GradeLevel," - ", teams.GradeLevel) AS Team'), 'cart_tmp.TeamId','cart_tmp.Name', 'cart_tmp.Number', 'sizes.Ordering', 'cart_tmp.Size')
|
||||
->leftjoin('products', 'cart_tmp.ProductURL','=','products.ProductURL')
|
||||
->leftjoin('teams', 'cart_tmp.TeamId','=','teams.Id')
|
||||
->leftjoin('sizes', 'cart_tmp.Size','=','sizes.Size')
|
||||
->orderby('sizes.Ordering', 'ASC')
|
||||
->orderby('cart_tmp.Number', 'ASC')
|
||||
->orderby('cart_tmp.Name', 'ASC')
|
||||
->where('cart_tmp.CartKey','=',$cartKey)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertPurchaseProduct($orders){
|
||||
|
||||
$i = DB::table('orders')->insert($orders);
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function flushCart($cartKey){
|
||||
|
||||
$i = DB::table('cart_tmp')->where('CartKey', $cartKey)->delete();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectCategory($id){
|
||||
$i = DB::table('template_categories')
|
||||
->whereIn('Id', $id)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplatesByCategory($url, $cat) //
|
||||
{
|
||||
$i = DB::table('sports')->where('URL', '=', $url)->get();
|
||||
$id = $i[0]->Id;
|
||||
|
||||
$k = DB::table('templates')->where('SportsId', '=', $id)
|
||||
->where('Category','=', $cat)
|
||||
->where('IsActive','=', "TRUE")
|
||||
->get();
|
||||
return $k;
|
||||
}
|
||||
|
||||
|
||||
function selectCategoryName($tempCode){
|
||||
$i = DB::table('templates')->select('templates.TemplateCode', 'template_categories.Category','category_ports.Port')
|
||||
->leftjoin('template_categories', 'templates.Category','=','template_categories.Id')
|
||||
->leftjoin('category_ports', 'template_categories.Id','=','category_ports.CategoryId')
|
||||
->where('templates.TemplateCode','=',$tempCode)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
14
app/Models/PatternsModel.php
Normal file
14
app/Models/PatternsModel.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class PatternsModel extends Model {
|
||||
|
||||
function selectAllPattern() // display all data from database
|
||||
{
|
||||
$i = DB::table('patterns')->orderBy('Id', 'ASC')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
31
app/Models/PrintPatternModel.php
Normal file
31
app/Models/PrintPatternModel.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class PrintPatternModel extends Model {
|
||||
|
||||
function selectAllPrintTemplate($q) // display all data from database
|
||||
{
|
||||
// $i = DB::table('print_pattern_list')
|
||||
// ->where('TemplateCode', $q)
|
||||
// ->get();
|
||||
$i = DB::table('print_pattern_list')->select('print_pattern_list.Id', 'print_pattern_list.TemplateCode', 'print_pattern_list.Path', 'print_pattern_list.Type', 'print_pattern_list.Size', 'print_pattern_list.DateCreated')
|
||||
->leftjoin('sizes', 'sizes.Size','=','print_pattern_list.Size')
|
||||
->where('print_pattern_list.TemplateCode','=',$q)
|
||||
->orderBy('sizes.Ordering', 'ASC')
|
||||
->get();
|
||||
return $i;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function insertPrintPattern($data){
|
||||
$i = DB::table('print_pattern_list')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
15
app/Models/SizesModel.php
Normal file
15
app/Models/SizesModel.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
|
||||
class SizesModel extends Model {
|
||||
|
||||
function selectAllSizes() // display all data from database
|
||||
{
|
||||
$i = DB::table('jersey_sizes')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
35
app/Models/SportsModel.php
Normal file
35
app/Models/SportsModel.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class SportsModel extends Model {
|
||||
|
||||
//
|
||||
function selectAllSports() // display all data from database
|
||||
{
|
||||
$i = DB::table('sports')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertToSports($data){
|
||||
$i = DB::table('sports')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectSports($q){
|
||||
$i = DB::table('sports')->where('URL', '=', $q)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function upateSportsDetails($data, $id){
|
||||
$i = DB::table('sports')->where('Id', $id)->update($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getSportsName() // display all data from database
|
||||
{
|
||||
$i = DB::table('sports')->select('Id', 'SportsName')->get();
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
60
app/Models/TemplatesModel.php
Normal file
60
app/Models/TemplatesModel.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class TemplatesModel extends Model {
|
||||
|
||||
function selectTemplates($id){
|
||||
$i = DB::table('templates')->where('SportsId', '=', $id)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplateTypes(){
|
||||
$i = DB::table('template_types')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplateLastId(){
|
||||
$i = DB::table('templates')->orderBy('Id', 'DESC')->first();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function insertNewTempalte($data){
|
||||
$i = DB::table('templates')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertTempaltePaths($data){
|
||||
$i = DB::table('template_paths')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplate($tempCode){
|
||||
$i = DB::table('templates')->where('TemplateCode', '=', $tempCode)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplatePaths($tempCode){
|
||||
$i = DB::table('template_paths')->where('TemplateCode', '=', $tempCode)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateNewTemplate($data, $templatecode){
|
||||
$i = DB::table('templates')->where('TemplateCode', $templatecode)->update($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateTemplatePaths($data, $Id){
|
||||
|
||||
// $i = DB::table('template_paths')->where([
|
||||
// ['TemplateCode', '=', $templatecode],
|
||||
// ['Type', '=', $data['Type']],
|
||||
// ['Side', '=', $data['Side']]
|
||||
// ])->update($data);
|
||||
$i = DB::table('template_paths')->where('Id', '=', $Id)->update($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
9
app/Models/cliparts/ClipartsModel.php
Normal file
9
app/Models/cliparts/ClipartsModel.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php namespace App\Models\cliparts;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ClipartsModel extends Model {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
140
app/Models/designer/DesignerModel.php
Normal file
140
app/Models/designer/DesignerModel.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php namespace App\Models\designer;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class DesignerModel extends Model {
|
||||
|
||||
function selectTemplate($templateid){
|
||||
$i = DB::table('templates')->where('HashTemplateCode', $templateid)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplatePaths($templateid){
|
||||
$i = DB::table('template_paths')->where('HashTemplateCode', $templateid)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplatePathsByTemplateCode($templateid){
|
||||
$i = DB::table('template_paths')->where('TemplateCode', $templateid)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectPatterns($patternId){
|
||||
$i = DB::table('patterns')->where('PatternId', $patternId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectPatternColors($patternId){
|
||||
$i = DB::table('pattern_colors')->where('PatternId', $patternId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectDefaultTemplateColor($templateCode){
|
||||
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT NULL AS RGBIndex, RGBColor AS default_Color FROM template_body_colors WHERE TemplateCode = '$templateCode' UNION SELECT TrimNumber, RGBColor AS default_Color FROM template_trim_colors WHERE TemplateCode = '$templateCode'");
|
||||
$query->execute();//$query->execute(array($bindings ));
|
||||
// $row=$query->fetch(\PDO::FETCH_OBJ);
|
||||
|
||||
while($row=$query->fetch(\PDO::FETCH_OBJ)) {
|
||||
if($row->RGBIndex == NULL){
|
||||
$IndexName = "default_mainColor";
|
||||
}else{
|
||||
$IndexName = $row->RGBIndex;
|
||||
}
|
||||
$arr_default_mainColor[] = array($IndexName => $row->default_Color);
|
||||
}
|
||||
// var_dump($arr_default_mainColor);
|
||||
return $arr_default_mainColor;
|
||||
}
|
||||
|
||||
function selectFontsByFontFamily($fontFamily){
|
||||
$i = DB::table('fonts')->where('fontFamily', $fontFamily)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectFonts(){
|
||||
$i = DB::table('fonts')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectClipartCategories(){
|
||||
$i = DB::table('clipart_categories')
|
||||
->orderby('Ordering', 'ASC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectClipartByCategory($categortId){
|
||||
$i = DB::table('cliparts')
|
||||
->where('CategoryId', $categortId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertClientDesign($design_info){
|
||||
|
||||
$i = DB::table('client_designs')->insert($design_info);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectClientDesign($designCode){
|
||||
|
||||
$i = DB::table('client_designs')
|
||||
->where('DesignCode', $designCode)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectProductURL($str){
|
||||
$i = DB::table('teamstore_products')->select('ProductURL')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStoreProductLastId(){
|
||||
$i = DB::table('teamstore_products')->orderBy('Id', 'DESC')->first();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateClientDesign($designName, $designCode){
|
||||
$i = DB::table('client_designs')->where('DesignCode', $designCode)
|
||||
->update(['DesignName' => $designName]);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectPatternsByTable($table, $patternId){
|
||||
$i = DB::table($table)->where('PatternId', $patternId)
|
||||
->get();
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getAvailableSizes($templateCode, $type){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT ppl.Id, ppl.TemplateCode, ppl.Path, ppl.Type, ppl.Size, ppl.DateCreated, js.Size FROM print_pattern_list AS ppl LEFT JOIN sizes AS js ON js.Size = ppl.Size WHERE ppl.TemplateCode = '$templateCode' AND ppl.Type = '$type' ORDER BY js.Ordering ASC");
|
||||
$query->execute();
|
||||
|
||||
while($row=$query->fetch(\PDO::FETCH_OBJ)) {
|
||||
$arr_size[] = $row->Size;
|
||||
}
|
||||
return $arr_size;
|
||||
}
|
||||
|
||||
function getDefaultPrice($size, $type){
|
||||
$i = DB::table('default_prices')
|
||||
->where('Size', $size)
|
||||
->where('Type', $type)
|
||||
->get();
|
||||
return $i;
|
||||
|
||||
}
|
||||
}
|
||||
21
app/Models/paypal/PayPalModel.php
Normal file
21
app/Models/paypal/PayPalModel.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php namespace App\Models\paypal;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class PayPalModel extends Model {
|
||||
|
||||
function insertToPaypalDetails($data){
|
||||
|
||||
$i = DB::table('payment_details')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function insertToOrders($data){
|
||||
|
||||
$i = DB::table('orders')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
135
app/Models/teamstore/TeamStoreModel.php
Normal file
135
app/Models/teamstore/TeamStoreModel.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php namespace App\Models\teamstore;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class TeamStoreModel extends Model {
|
||||
|
||||
function selectAllTeamStore() // display all data from database
|
||||
{
|
||||
$i = DB::table('teamstores')
|
||||
->where("IsActive", "true")
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStoreProducts($field, $teamstoreId) // display all data from database
|
||||
{
|
||||
$i = DB::table('teamstore_products')
|
||||
->where($field, $teamstoreId)
|
||||
->orderBy('Ordering', 'ASC')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStore($field, $teamstoreURL) // display all data from database
|
||||
{
|
||||
$i = DB::table('teamstores')
|
||||
->where($field, $teamstoreURL)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getProductThumbnails($productId){
|
||||
|
||||
$i = DB::table('teamstore_product_thumbnails')->where('ProductId', $productId)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertTeamStoreProduct($item_details){
|
||||
|
||||
$i = DB::table('teamstore_products')->insert($item_details);
|
||||
$id = DB::getPdo()->lastInsertId();
|
||||
|
||||
return array(
|
||||
'i' => $i,
|
||||
'lastId' => $id
|
||||
);
|
||||
}
|
||||
|
||||
function insertTeamStoreProductThumbnails($item_details){
|
||||
|
||||
$i = DB::table('teamstore_product_thumbnails')->insert($item_details);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getThumbnails($productId){
|
||||
|
||||
$i = DB::table('teamstore_product_thumbnails')->where('ProductId', $productId)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getTeams($productId){
|
||||
|
||||
$i = DB::table('teams')->where('ProductId', $productId)->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getSizes(){
|
||||
|
||||
$i = DB::table('sizes')
|
||||
->where('IsActive', 'TRUE')
|
||||
->orderby('Ordering', 'ASC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertToCart($data){
|
||||
|
||||
$i = DB::table('cart_tmp')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function myCart($cartKey){
|
||||
// echo $cartKey;
|
||||
if($cartKey != ""){
|
||||
|
||||
// $i = DB::table('cart_tmp')->select('cart_tmp.Id', 'cart_tmp.Order', 'cart_tmp.ProductId', 'cart_tmp.CartKey', 'cart_tmp.ProductURL', 'cart_tmp.TeamName', 'teams.Team', 'cart_tmp.Name', 'cart_tmp.Number', 'cart_tmp.Size', 'cart_tmp.Price', 'cart_tmp.Quantity', 'teamstore_products.ProductName', 'teamstore_products.ProductURL', 'teamstore_product_thumbnails.Image')
|
||||
// ->leftjoin('teamstore_products', 'cart_tmp.ProductURL','=','teamstore_products.ProductURL')
|
||||
// ->leftjoin('teams', 'cart_tmp.TeamName','=','teams.Team')
|
||||
// ->leftjoin('teamstore_product_thumbnails', 'cart_tmp.ProductId','=','teamstore_product_thumbnails.ProductId')
|
||||
// ->where('cart_tmp.CartKey','=',$cartKey)
|
||||
// ->where('teamstore_product_thumbnails.ImageClass','=','active')
|
||||
// ->orderby('cart_tmp.Id', 'DESC')
|
||||
// ->get();
|
||||
$i = DB::table('cart_tmp')
|
||||
->where('CartKey', $cartKey)
|
||||
->get();
|
||||
|
||||
// var_dump($i);
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
|
||||
function myCartGroup($cartKey){
|
||||
if($cartKey != ""){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, SUM(Price) AS total_price FROM cart_tmp WHERE CartKey = :ck GROUP BY ProductId");
|
||||
$query->execute([':ck'=>$cartKey]);
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
// $i = DB::table('cart_tmp')->()
|
||||
// ->where('CartKey', $cartKey)
|
||||
// ->groupby('ProductId')
|
||||
// ->get();
|
||||
|
||||
// // var_dump($i);
|
||||
return $row;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getSubtotal($cartKey){
|
||||
|
||||
$i = DB::table('cart_tmp')->select(DB::raw('SUM(Quantity * Price) AS Subtotal'))
|
||||
->where('CartKey','=',$cartKey)
|
||||
->get();
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
function updateStoreItem($data, $url){
|
||||
$i = DB::table('teamstore_products')->where('ProductURL', $url)
|
||||
->update($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
137
app/Models/user/UserModel.php
Normal file
137
app/Models/user/UserModel.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php namespace App\Models\user;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use DB;
|
||||
|
||||
class UserModel extends Model {
|
||||
|
||||
function insertAddressBook($data){
|
||||
|
||||
$i = DB::table('user_address_book')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectAddresBook($field, $userId){
|
||||
|
||||
$i = DB::table('user_address_book')
|
||||
->where($field,'=',$userId)
|
||||
->get();
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
function saveUpdateAddressBook($data, $id){
|
||||
$i = DB::table('user_address_book')->where('Id', $id)
|
||||
->update($data);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectProfileInfo($id){
|
||||
|
||||
$i = DB::table('user_logins')->select('user_logins.name', 'user_logins.username', 'user_logins.email', 'user_logins.email_is_verified', 'user_logins.role', 'user_logins.store_id', 'user_info.ContactNumber', 'user_info.Gender', 'user_info.Birthday')
|
||||
->leftjoin('user_info', 'user_info.UserId','=','user_logins.id')
|
||||
->where('user_logins.id','=',$id)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function saveUpdateUserLogins($data, $id){
|
||||
$i = DB::table('user_logins')->where('id', $id)
|
||||
->update($data);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function saveUpdateUserInfo($data, $id){
|
||||
$exists = DB::table('user_info')->where('UserId', $id)->first();
|
||||
|
||||
if(!$exists){
|
||||
$i = DB::table('user_info')->insert($data);
|
||||
}else{
|
||||
$i = DB::table('user_info')
|
||||
->where('UserId', $id)
|
||||
->update($data);
|
||||
}
|
||||
return $i;
|
||||
|
||||
}
|
||||
|
||||
function saveUpdatePassword($password, $id){
|
||||
|
||||
$i = DB::table('user_logins')->where('id', $id)
|
||||
->update(['password' => $password]);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectPaymentDetails($userid){
|
||||
|
||||
$i = DB::table('payment_details')->where('UserId', $userid)
|
||||
->get();
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectClientDesigns($userid){
|
||||
|
||||
$i = DB::table('client_designs')->where('ClientId', $userid)
|
||||
->orderBy('Id', 'DESC')
|
||||
->paginate(12) ;
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectClientDesignsbyCode($code){
|
||||
|
||||
$i = DB::table('client_designs')->where('DesignCode', $code)
|
||||
->get();
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplatePaths($field, $templateid){
|
||||
$i = DB::table('template_paths')->where($field, $templateid)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateClientDesign($data, $id){
|
||||
$i = DB::table('client_designs')->where('DesignCode', $id)
|
||||
->update($data);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectStoreInfo($storeId){
|
||||
$i = DB::table('teamstores')->where('Id', $storeId)
|
||||
->get();
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function saveResendCode($data){
|
||||
|
||||
$res = DB::table('email_verification_codes')->where("EmailAddress", $data['EmailAddress'])
|
||||
->get();
|
||||
|
||||
if($res){
|
||||
$i = DB::table('email_verification_codes')->where('EmailAddress', $data['EmailAddress'])
|
||||
->update($data);
|
||||
return $i;
|
||||
}else{
|
||||
$i = DB::table('email_verification_codes')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function validateCode($data){
|
||||
|
||||
$i = DB::table('email_verification_codes')->where('EmailAddress', $data['EmailAddress'])
|
||||
->where('VerCode', $data['Code'])
|
||||
->get();
|
||||
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
37
app/Providers/AppServiceProvider.php
Normal file
37
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
\Blade::extend(function($value) {
|
||||
return preg_replace('/\@define(.+)/', '<?php ${1}; ?>', $value);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* This service provider is a great spot to register your various container
|
||||
* bindings with the application. As you can see, we are registering our
|
||||
* "Registrar" implementation here. You can add your own bindings too!
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'Illuminate\Contracts\Auth\Registrar',
|
||||
'App\Services\Registrar'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
34
app/Providers/BusServiceProvider.php
Normal file
34
app/Providers/BusServiceProvider.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Illuminate\Bus\Dispatcher;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BusServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @param \Illuminate\Bus\Dispatcher $dispatcher
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Dispatcher $dispatcher)
|
||||
{
|
||||
$dispatcher->mapUsing(function($command)
|
||||
{
|
||||
return Dispatcher::simpleMapping(
|
||||
$command, 'App\Commands', 'App\Handlers\Commands'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
23
app/Providers/ConfigServiceProvider.php
Normal file
23
app/Providers/ConfigServiceProvider.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ConfigServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Overwrite any vendor / package configuration.
|
||||
*
|
||||
* This service provider is intended to provide a convenient location for you
|
||||
* to overwrite any "vendor" or package configuration that you may want to
|
||||
* modify before the application handles the incoming request / command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
config([
|
||||
//
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
32
app/Providers/EventServiceProvider.php
Normal file
32
app/Providers/EventServiceProvider.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* The event handler mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [
|
||||
'event.name' => [
|
||||
'EventListener',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any other events for your application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $events
|
||||
* @return void
|
||||
*/
|
||||
public function boot(DispatcherContract $events)
|
||||
{
|
||||
parent::boot($events);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
44
app/Providers/RouteServiceProvider.php
Normal file
44
app/Providers/RouteServiceProvider.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* This namespace is applied to the controller routes in your routes file.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
parent::boot($router);
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
$router->group(['namespace' => $this->namespace], function($router)
|
||||
{
|
||||
require app_path('Http/routes.php');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
54
app/Services/Registrar.php
Normal file
54
app/Services/Registrar.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php namespace App\Services;
|
||||
|
||||
use App\User;
|
||||
use Validator;
|
||||
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
|
||||
use App\Traits\CaptchaTrait;
|
||||
|
||||
class Registrar implements RegistrarContract {
|
||||
use CaptchaTrait;
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
public function validator(array $data)
|
||||
{
|
||||
|
||||
|
||||
$data['captcha'] = $this->captchaCheck();
|
||||
|
||||
return Validator::make($data, [
|
||||
'name' => 'required|max:255',
|
||||
'username' => 'required|max:255|unique:user_logins',
|
||||
'email' => 'required|email|max:255|unique:user_logins',
|
||||
'password' => 'required|confirmed|min:6',
|
||||
'g-recaptcha-response' => 'required',
|
||||
'captcha' => 'required|min:1'
|
||||
],
|
||||
[
|
||||
'g-recaptcha-response.required' => 'Captcha is required',
|
||||
'captcha.min' => 'Wrong captcha, please try again.'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return User
|
||||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'username' => $data['username'],
|
||||
'email' => $data['email'],
|
||||
'password' => bcrypt($data['password']),
|
||||
'role' => 'user'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
25
app/Traits/CaptchaTrait.php
Normal file
25
app/Traits/CaptchaTrait.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php namespace App\Traits;
|
||||
|
||||
use Input;
|
||||
use ReCaptcha\ReCaptcha;
|
||||
|
||||
trait CaptchaTrait {
|
||||
|
||||
public function captchaCheck()
|
||||
{
|
||||
|
||||
$response = Input::get('g-recaptcha-response');
|
||||
$remoteip = $_SERVER['REMOTE_ADDR'];
|
||||
$secret = env('CAPTCHA_SECRET_KEY');
|
||||
|
||||
$recaptcha = new ReCaptcha($secret);
|
||||
$resp = $recaptcha->verify($response, $remoteip);
|
||||
if ($resp->isSuccess()) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
34
app/User.php
Normal file
34
app/User.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php namespace App;
|
||||
|
||||
use Illuminate\Auth\Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Auth\Passwords\CanResetPassword;
|
||||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
|
||||
|
||||
class User extends Model implements AuthenticatableContract, CanResetPasswordContract {
|
||||
|
||||
use Authenticatable, CanResetPassword;
|
||||
|
||||
/**
|
||||
* The database table used by the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'user_logins';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name', 'username', 'email', 'password', 'role'];
|
||||
|
||||
/**
|
||||
* The attributes excluded from the model's JSON form.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = ['password', 'remember_token'];
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user