first commit

This commit is contained in:
root
2021-07-10 10:15:55 +00:00
commit 124161318b
7693 changed files with 808583 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
class Inspire extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = '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);
}
}

30
app/Console/Kernel.php Normal file
View File

@@ -0,0 +1,30 @@
<?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 = [
// Commands\Inspire::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
}

8
app/Events/Event.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
namespace App\Events;
abstract class Event
{
//
}

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Exceptions;
use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
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 = [
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
];
/**
* 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)
{
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);
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use Illuminate\Support\Facades\Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
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, ThrottlesLogins;
/**
* Where to redirect users after login / registration.
*
* @var string
*/
protected $redirectTo = '/';
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
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;
/**
* Create a new password controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
class Controller extends BaseController
{
use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Auth;
use Validator;
use Redirect;
class LoginController extends Controller
{
public function authenticate(Request $request) {
$post = $request->all();
$email = $post['email'];
$password = $post['password'];
if (Auth::attempt(['email' => $email, 'password' => $password])) {
// Authentication passed...
if (Auth::user()->role == 'admin') {
// return $next($request);
return redirect()->intended('admin');
}
return redirect('/logout');
}else{
return Redirect::back()->withErrors(array(
'error'=>'Invalid Email Address or Password'
));
}
}
}

File diff suppressed because it is too large Load Diff

55
app/Http/Kernel.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\Cors::class,
];
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
],
'api' => [
'throttle:60,1',
],
];
/**
* The application's route middleware.
*
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'admin' => \App\Http\Middleware\IsAdmin::class,
];
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class Authenticate
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->guest()) {
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('login');
}
}
return $next($request);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Closure;
class Cors
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
return $next($request)
->header('Access-Control-Allow-Origin', '*')
->header('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE, OPTIONS')
->header('Access-Control-Allow-Headers', 'Content-Type, Authorizations');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
class EncryptCookies extends BaseEncrypter
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}

View File

@@ -0,0 +1,24 @@
<?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()->back();
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/');
}
return $next($request);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest
{
//
}

100
app/Http/routes.php Normal file
View File

@@ -0,0 +1,100 @@
<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| 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('/', function () {
return view('welcome');
});
Route::post('/custom/auth', 'LoginController@authenticate');
Route::post('/custom/register', 'CustomAuthController@postRegister');
Route::group(['middleware' => 'auth'], function () {
Route::group(['prefix' => 'admin', 'middleware' => 'admin'], function () {
Route::get('/', 'admin\AdminController@dashboard');
Route::get('orders', 'admin\AdminController@orders');
Route::get('orders/view/{ck}', 'admin\AdminController@viewOrders');
Route::get('orders/view/{ck}/print', 'admin\AdminController@printOrder');
Route::get('create-store', 'admin\AdminController@createStore');
Route::post('orders/download', 'admin\AdminController@download');
Route::post('create-store/save', 'admin\AdminController@saveNewStore');
Route::get('stores-list', 'admin\AdminController@storeList');
Route::get('view-store/{id}', 'admin\AdminController@viewStore');
Route::post('store/update', 'admin\AdminController@updateStore');
Route::post('store/delete/{id}/{url}', 'admin\AdminController@deleteStore');
Route::get('overlay-pattern', 'admin\AdminController@overlayPattern');
Route::get('overlay-pattern', 'admin\AdminController@overlayPattern');
Route::get('reports', 'admin\AdminController@viewReports');
Route::get('commission', 'admin\AdminController@viewCommission');
Route::get('clipart-add', 'admin\AdminController@addClipart');
Route::get('cliparts', 'admin\AdminController@viewClipart');
Route::get('clipart-categories', 'admin\AdminController@viewClipartCategories');
Route::post('clipart/save-category', 'admin\AdminController@saveClipartCategory');
Route::post('clipart/save-svg-clipart', 'admin\AdminController@saveSVGClipart');
Route::post('clipart/delete-clipart-category', 'admin\AdminController@deleteClipartCategory');
Route::post('clipart/save-clipart-cat-ordering', 'admin\AdminController@saveClipartCatOrdering');
Route::post('clipart/update-clipart-category', 'admin\AdminController@updateClipartCategory');
Route::post('clipart/delete', 'admin\AdminController@deleteClipart');
Route::get('visualizer/add', 'admin\AdminController@visualizerAdd');
Route::get('visualizer', 'admin\AdminController@visualizer');
Route::post('visualizer/request/get-sports-category', 'admin\AdminController@selectSportsCategory');
Route::get('/get-overlay-pattern', 'admin\AdminController@getOverlayPattern');
Route::post('/add-new-visualizer/save', 'admin\AdminController@saveNewVisualizer');
Route::get('/view-visualizer/{id}', 'admin\AdminController@viewVisualizer');
Route::post('visualizer/delete', 'admin\AdminController@deleteVisualizer');
Route::post('visualizer/update', 'admin\AdminController@updateVisualizer');
Route::get('print-files', 'admin\AdminController@printFiles');
Route::get('print-files/{tempid}', 'admin\AdminController@printFilesDetails');
Route::post('print-files/delete', 'admin\AdminController@printFilesDelete');
Route::get('upload-print-file', 'admin\AdminController@uploadPrintFile');
Route::post('upload-print-file/save', 'admin\AdminController@uploadPrintFileSave');
Route::get('user-list', 'admin\AdminController@userList');
Route::post('post/update-user-as-store-owner', 'admin\AdminController@updatUserAsStoreOwner');
Route::post('post/remove-store-access', 'admin\AdminController@removeStoreAccess');
Route::post('post/save-new-store-owner', 'admin\AdminController@saveNewStoreOwner');
Route::post('post/show-store-order-details', 'admin\AdminController@showStoreOrderDetails');
// Download Routes /////////////////
Route::get('orders/download/tshirt/{ck}/{id}', 'admin\AdminController@downloadPrintFile_tshirt');
Route::get('orders/download/jersey/{ck}/{id}', 'admin\AdminController@downloadPrintFile_jersey');
Route::get('orders/download/mask/{ck}/{id}', 'admin\AdminController@downloadPrintFile_mask');
// End Download Routes /////////////
Route::get('tax-settings', 'admin\AdminController@taxIndex');
Route::post('post/update-hibernate', 'admin\AdminController@updateHibernate');
});
});
Route::auth();
// Route::get('/home', 'HomeController@index');

21
app/Jobs/Job.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
abstract class Job
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "onQueue" and "delay" queue helper methods.
|
*/
use Queueable;
}

1
app/Listeners/.gitkeep Normal file
View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,499 @@
<?php
namespace App\Models\admin;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class AdminModel extends Model
{
function selectPaymentDetails($field, $value){
if($field != "All"){
$i = DB::table('payment_details')
->where($field, $value)
->orderby('Id', 'ASC')
->get();
}else{
$i = DB::table('payment_details')
->leftjoin('orders', 'payment_details.CartKey', '=', 'orders.CartKey')
->leftjoin('teamstores', 'teamstores.Id', '=', 'orders.StoreId')
->select('payment_details.*', 'orders.StoreId', 'teamstores.StoreName')
->where("payment_details.CartKey", "!=", null)
->groupby('orders.CartKey')
->orderby('payment_details.Id', 'ASC')
->get();
}
return $i;
}
function selectOrderItem($field, $ck){
$i = DB::table('orders')
->where($field, $ck)
->get();
return $i;
}
function itemGroup($cartKey){
$pdo = DB::connection()->getPdo();
$query = $pdo->prepare("SELECT orders.*, COUNT(orders.Id) AS qty, orders.Price * SUM(orders.Quantity) AS total_price, teamstores.StoreName FROM orders LEFT JOIN teamstores on teamstores.Id = orders.StoreId WHERE CartKey = :ck GROUP BY ProductId");
$query->execute([':ck'=>$cartKey]);
$row = $query->fetchAll(\PDO::FETCH_OBJ);
return $row;
}
function selectDisplayItemThumb(){
$i = DB::table('teamstore_product_thumbnails')
->where('ImageClass', 'active')
->get();
return $i;
}
function selectShippingAddress($field, $value){
$i = DB::table('shipping_addresses')
->where($field, $value)
->get();
return $i;
}
function selectClientDesign($design_code){
$i = DB::table('client_designs')
->where('DesignCode', $design_code)
->get();
return $i;
}
function insertTeamstore($data){
$i = DB::table('teamstores')->insert($data);
return $i;
}
function selectTeamstore(){
$i = DB::table('teamstores')
->paginate(16);
return $i;
}
function selectTeamstoreFilter($field, $value){
$i = DB::table('teamstores')
->orderby($field, $value)
->paginate(16);
return $i;
}
function selectTeamstoreSearch($field, $value, $keyword){
$i = DB::table('teamstores')
->where("StoreName", "LIKE","%$keyword%")
->orderby($field, $value)
->paginate(16);
return $i;
}
function selectTeamstoreById($id){
$i = DB::table('teamstores')
->where("Id", $id)
->get();
return $i;
}
function updateTeamstore($id, $data){
$i = DB::table('teamstores')
->where("Id", $id)
->update($data);
return $i;
}
function deleteTeamstoreById($id){
$i = DB::table('teamstores')
->where("Id", $id)
->delete();
return $i;
}
function selectPattern(){
$i = DB::table('patterns')
->get();
return $i;
}
function selectPatternWithfield($field, $value){
$i = DB::table('patterns')
->where($field, $value)
->get();
return $i;
}
function selectClipartCategory(){
$i = DB::table('clipart_categories')
->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id')
->select('clipart_categories.*', 'user_logins.username')
->orderby('clipart_categories.Ordering', 'ASC')
->get();
return $i;
}
function ClipartCategory(){
$i = DB::table('clipart_categories')
->leftjoin('user_logins', 'clipart_categories.UserId', '=', 'user_logins.id')
->select('clipart_categories.*', 'user_logins.username')
->orderby('clipart_categories.Ordering', 'ASC')
->paginate(18);
return $i;
}
function selectStoreOwners($store_id){
$i = DB::table('user_logins')
->where('role', 'store_owner')
->where('store_id', $store_id)
->get();
return $i;
}
function insertClipartCategory($data){
$i = DB::table('clipart_categories')->insertGetId($data);
return $i;
}
function insertClipart($data){
$i = DB::table('cliparts')->insert($data);
return $i;
}
function updateClipartCatOrdering($order, $id){
$i = DB::table('clipart_categories')->where('Id', $id)
->update(['Ordering' => $order]);
}
function userList(){
$i = DB::table('user_logins')
->select('id', 'name', 'username', 'email')
// ->where("name", "LIKE","%$keyword%")
// ->orWhere("username", "LIKE","%$keyword%")
// ->orWhere("email", "LIKE","%$keyword%")
->where("role", "user")
->orderby('name', 'ASC')
->get();
return $i;
}
function makeUserAsStoreOwner($data){
$i = DB::table('user_logins')
->where("Id", $data['user_id'])
->update(['role'=> 'store_owner', 'store_id'=> $data['store_id']]);
return $i;
}
function model_removeStoreAccess($data){
$i = DB::table('user_logins')
->where("Id", $data['user_id'])
->update(['role'=> 'user', 'store_id'=> $data['store_id']]);
return $i;
}
function deleteClipartCategory($id){
$i = DB::table('clipart_categories')
->where("Id", $id)
->delete();
return $i;
}
function deleteClipart($id){
$i = DB::table('cliparts')
->where("Id", $id)
->delete();
return $i;
}
function updateClipartCategory($id, $data){
$i = DB::table('clipart_categories')
->where("Id", $id)
->update($data);
return $i;
}
function selectCliparts($cat_id){
if($cat_id != 0 || $cat_id != ""){
$i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName')
->leftjoin('clipart_categories', 'clipart_categories.Id','=','cliparts.CategoryId')
->where('cliparts.CategoryId', $cat_id)
->orderby("Id", "DESC")
->paginate(16);
return $i;
}else{
$i = DB::table('cliparts')->select('cliparts.*', 'clipart_categories.CategoryName')
->leftjoin('clipart_categories', 'clipart_categories.Id','=','cliparts.CategoryId')
// ->where('cliparts.CategoryId', $cat_id)
->orderby("Id", "DESC")
->paginate(16);
return $i;
}
}
function selectSports(){
$i = DB::table('sports')
->orderby("SportsName", "ASC")
->get();
return $i;
}
function selectSportsCategory($id){
$i = DB::table('template_categories')
->where('TemplateId', $id)
->orderby("Category", "ASC")
->get();
return $i;
}
function selectStoreOrders(){
$i = DB::table('orders')->select('orders.*', 'orders.Id as Order_Id', 'orders.DateCreated AS date_ordered', 'payment_details.InvoiceNumber', 'payment_details.Currency', 'payment_details.Payer_Email', 'payment_details.Payer_Firstname', 'payment_details.Payer_Lastname', 'shipping_addresses.*', 'teamstores.*')
->leftjoin('payment_details', 'payment_details.CartKey','=','orders.CartKey')
->leftjoin('shipping_addresses', 'shipping_addresses.PaymentDetail_Id','=','payment_details.Id')
->leftjoin('teamstores', 'teamstores.Id','=','orders.StoreId')
// ->where('orders.StoreId', $store_id)
->orderby('orders.DateCreated', 'DESC')
->get();
return $i;
}
function saveNewVisualizer($data){
$i = DB::table('templates')->insert($data);
$id = DB::getPdo()->lastInsertId();
return array(
'i' => $i,
'lastId' => $id
);
}
function updateVisualizer($id, $data){
$i = DB::table('templates')
->where("Id", $id)
->update($data);
return $i;
}
function saveVisualizerDefaultBodyColor($data){
$i = DB::table('template_body_colors')->insert($data);
return $i;
}
function saveVisualizerDefaultTrimColor($data){
$i = DB::table('template_trim_colors')->insert($data);
return $i;
}
function saveVisualizerPath($data){
$i = DB::table('template_paths')->insert($data);
return $i;
}
function selectVisualizer($sports_id, $sports_category){
$i = DB::table('templates')
->where('SportsId', $sports_id)
->where('Category', $sports_category)
->orderBy('Id', 'DESC')
->get();
return $i;
}
function selectDisplayItemThumbById($id){
$i = DB::table('teamstore_product_thumbnails')
->where('ProductId', $id)
->where('ImageClass', 'active')
->get();
return $i;
}
function selectOrder($field, $value){
$i = DB::table('orders')
->where($field, $value)
->get();
return $i;
}
function editVisualizer($id){
$i = DB::table('templates')
->where('Id', $id)
->get();
return $i;
}
function deleteVisualizer($id){
$i = DB::table('templates')
->where("Id", $id)
->delete();
return $i;
}
function deleteDefaultBodyColor($tempCode){
$i = DB::table('template_body_colors')
->where("TemplateCode", $tempCode)
->delete();
return $i;
}
function deleteTemplatePath($tempCode){
$i = DB::table('template_paths')
->where("TemplateCode", $tempCode)
->delete();
return $i;
}
function deleteDefaultTrimColor($tempCode){
$i = DB::table('template_trim_colors')
->where("TemplateCode", $tempCode)
->delete();
return $i;
}
function deletePrintPatternList($tempCode){
$i = DB::table('print_pattern_list')
->where("TemplateCode", $tempCode)
->delete();
return $i;
}
function selectTemplatePath($tempCode){
$i = DB::table('template_paths')
->where("TemplateCode", $tempCode)
->get();
return $i;
}
function selectDefaultBodyColor($tempCode){
$i = DB::table('template_body_colors')
->where("TemplateCode", $tempCode)
->get();
return $i;
}
function selectDefaultTrimColor($tempCode){
$i = DB::table('template_trim_colors')
->where("TemplateCode", $tempCode)
->get();
return $i;
}
function updateDefaultBodyColor($tempCode, $data){
$i = DB::table('template_body_colors')
->where("TemplateCode", $tempCode)
->update($data);
return $i;
}
function updateVisualizerPath($id, $data){
$i = DB::table('template_paths')
->where("Id", $id)
->update($data);
return $i;
}
function selectCommission(){
$i = DB::select("SELECT t.StoreName, pd.InvoiceNumber, pd.CartKey, pd.Total, pd.SubTotal, pd.Tax, pd.Currency,
(pd.Total * 0.029) AS proc_fee,
(pd.SubTotal - 0.29) AS trans_rate, ROUND(((
SELECT trans_rate) - (
SELECT proc_fee)), 2) AS commission_rate, ROUND(((
SELECT commission_rate) * 0.25), 2) AS twenty_five_percent, ROUND(((
SELECT commission_rate) * 0.05), 2) AS five_percent
FROM orders AS o
INNER JOIN payment_details AS pd ON pd.CartKey = o.CartKey
INNER JOIN teamstores AS t ON o.StoreId = t.Id
GROUP BY pd.CartKey
ORDER BY o.DateCreated");
return $i;
}
function selectVisualizerPrint(){
$i = DB::select("SELECT t.TemplateCode, t.Thumbnail, t.TemplateName, t.IsActive,
s.SportsName, tc.Category
FROM templates AS t
LEFT JOIN sports AS s ON t.SportsId = s.Id
LEFT JOIN template_categories AS tc ON tc.Id = t.Category");
return $i;
}
function insertPrintFiles($data){
$i = DB::table('print_pattern_list')->insert($data);
return $i;
}
function selectGroupPrintFiles(){
$i = DB::select("SELECT ppl.TemplateCode, t.TemplateName, s.SportsName, tc.Category
FROM print_pattern_list AS ppl
INNER JOIN templates AS t ON t.TemplateCode = ppl.TemplateCode
INNER JOIN sports AS s ON s.Id = t.SportsId
INNER JOIN template_categories AS tc ON tc.Id = t.Category
GROUP BY ppl.TemplateCode");
return $i;
}
function selectPrintFiles($tempCode){
$i = DB::select("SELECT t.TemplateName, ppl.Id, ppl.Path, ppl.`Type`, ppl.Size from templates AS t
INNER JOIN print_pattern_list AS ppl ON ppl.TemplateCode = t.TemplateCode
WHERE t.TemplateCode = '$tempCode'
ORDER BY ppl.`Type` ASC");
return $i;
}
function deletePrintFiles($id){
$i = DB::table('print_pattern_list')
->where("Id", $id)
->delete();
return $i;
}
function selectTax(){
$i = DB::select("SELECT t.Id, t.StoreName, tx.DateCreated FROM tax AS tx
INNER JOIN teamstores AS t
ON t.Id = tx.TeamstoreId");
return $i;
}
}

1
app/Policies/.gitkeep Normal file
View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Providers;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any application authentication / authorization services.
*
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
* @return void
*/
public function boot(GateContract $gate)
{
$this->registerPolicies($gate);
//
}
}

View File

@@ -0,0 +1,33 @@
<?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 listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\SomeEvent' => [
'App\Listeners\EventListener',
],
];
/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);
//
}
}

View File

@@ -0,0 +1,61 @@
<?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 your controller routes.
*
* 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)
{
$this->mapWebRoutes($router);
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
protected function mapWebRoutes(Router $router)
{
$router->group([
'namespace' => $this->namespace, 'middleware' => 'web',
], function ($router) {
require app_path('Http/routes.php');
});
}
}

28
app/User.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'user_logins';
protected $fillable = [
'name', 'username', 'email', 'password', 'role', 'store_id'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}