first commit
This commit is contained in:
152
app/Models/ApiModel.php
Normal file
152
app/Models/ApiModel.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace App\models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ApiModel extends Model
|
||||
{
|
||||
|
||||
function loginProductionUser($username, $password)
|
||||
{
|
||||
$i = DB::table('production_user')
|
||||
->where('Username', $username)
|
||||
->where('Password', $password)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTrackingStepLabel($id)
|
||||
{
|
||||
$i = DB::table('tracking_steps')->select('StepLabel')
|
||||
->where('Id', $id)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getTrackingStatus($invoice)
|
||||
{
|
||||
$i = DB::table('tracking')->select('tracking.Id', 'tracking.InvoiceNumber', 'tracking_steps.StepLabel', 'production_user.Name', DB::raw('DATE_FORMAT(tracking.created_at, "%b %d, %Y") AS date'), DB::raw('DATE_FORMAT(tracking.created_at, "%H:%i") AS time'))
|
||||
->leftjoin('tracking_steps', 'tracking_steps.Id', '=', 'tracking.StepId')
|
||||
->leftjoin('production_user', 'production_user.Id', '=', 'tracking.ScannedBy')
|
||||
->where('tracking.InvoiceNumber', '=', $invoice)
|
||||
->orderBy('tracking.created_at', 'DESC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectPaymentDetails($invoice)
|
||||
{
|
||||
$i = DB::table('payment_details')
|
||||
->where('InvoiceNumber', $invoice)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectOrderList($cartKey)
|
||||
{
|
||||
$i = DB::table('orders')->select('ProductId', 'ProductName', 'CartKey')
|
||||
->where('CartKey', $cartKey)
|
||||
->groupBy('ProductId')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectProductImages($productId)
|
||||
{
|
||||
$i = DB::table('teamstore_product_thumbnails')
|
||||
->where('ProductId', $productId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectOrderListTableFields($cartKey, $productId, $stepid)
|
||||
{
|
||||
// $i = DB::table('orders')->select('Id', 'Name', 'Name2', 'Number', 'Size', 'JerseySize', 'ShortsSize', 'Quantity')
|
||||
// ->where('CartKey', $cartKey)
|
||||
// ->where('ProductId', $productId)
|
||||
// ->get();
|
||||
// return $i;
|
||||
|
||||
$i = DB::table('orders')->select('orders.Id', 'orders.Name', 'orders.Name2', 'orders.Number', 'orders.Size', 'orders.JerseySize',
|
||||
'orders.ShortsSize', 'orders.Quantity', DB::raw('(SELECT COUNT(*) FROM tracking WHERE StepId = '.$stepid.' AND OrdersId = orders.Id) AS Status'))
|
||||
// ->leftjoin('tracking', 'orders.Id', '=', 'tracking.OrdersId')
|
||||
// ->where('tracking.StepId', $stepid)
|
||||
->where('orders.CartKey', $cartKey)
|
||||
->where('orders.ProductId', $productId)
|
||||
->groupBy('orders.Id')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertTracking($data)
|
||||
{
|
||||
$i = DB::table('tracking')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
// function selectNextStep($invoice)
|
||||
// {
|
||||
// $i = DB::table('tracking')->select('StepId')
|
||||
// ->where('InvoiceNumber', $invoice)
|
||||
// ->orderBy('StepId', 'DESC')->first();
|
||||
// return $i;
|
||||
// }
|
||||
|
||||
function checkIfTrackExist($stepid, $productid, $orderid, $invoice, $qcounter)
|
||||
{
|
||||
$i = DB::table('tracking')
|
||||
->where('StepId', $stepid)
|
||||
->where('ProductId', $productid)
|
||||
->where('OrdersId', $orderid)
|
||||
->where('InvoiceNumber', $invoice)
|
||||
->where('QuantityCounter', $qcounter)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getCurrentTrackingSteps($invoice){
|
||||
$i = DB::table('tracking')->select('StepId')
|
||||
->where('InvoiceNumber', $invoice)
|
||||
->groupBy('StepId')
|
||||
->orderBy('StepId', 'ASC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getStatus($invoice, $productid, $orderid, $qcounter){
|
||||
$i = DB::table('tracking')->select('production_user.Name', DB::raw('DATE_FORMAT(tracking.created_at, "%b %d, %Y - %H:%i") AS datetime'))
|
||||
->leftjoin('production_user', 'production_user.Id', '=', 'tracking.ScannedBy')
|
||||
->where('tracking.InvoiceNumber', $invoice)
|
||||
->where('tracking.ProductId', $productid)
|
||||
->where('tracking.OrdersId', $orderid)
|
||||
->where('tracking.QuantityCounter', $qcounter)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectSteps(){
|
||||
$i = DB::table('tracking_steps')
|
||||
->orderBy('Order', 'ASC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectCurrentStep($invoice){
|
||||
$i = DB::table('tracking')->select('tracking_steps.*')
|
||||
->leftjoin('tracking_steps', 'tracking_steps.Id', '=', 'tracking.StepId')
|
||||
->where('tracking.InvoiceNumber', $invoice)
|
||||
->orderBy('tracking.StepId', 'DESC')
|
||||
->first();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function selectCurrentStepOrder($stepOrder){
|
||||
$i = DB::table('tracking_steps')
|
||||
->where('Order', $stepOrder)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
169
app/Models/MainModel.php
Normal file
169
app/Models/MainModel.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?php namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\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){ //
|
||||
|
||||
$i = DB::table('cart_tmp')
|
||||
->whereNull('VoucherId')
|
||||
->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 Illuminate\Support\Facades\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 {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
144
app/Models/designer/DesignerModel.php
Normal file
144
app/Models/designer/DesignerModel.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?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)
|
||||
->where('IsActive', 'TRUE')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTemplatePathsByTemplateCode($templateid){
|
||||
$i = DB::table('template_paths')->where('TemplateCode', $templateid)
|
||||
->where('IsActive', 'TRUE')
|
||||
->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, DisplayName FROM template_body_colors WHERE TemplateCode = '$templateCode' UNION SELECT TrimNumber, RGBColor AS default_Color, DisplayName FROM template_trim_colors WHERE TemplateCode = '$templateCode'");
|
||||
$query->execute();
|
||||
|
||||
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,
|
||||
'h4_Trim_' . $IndexName => $row->DisplayName,
|
||||
);
|
||||
}
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
41
app/Models/paypal/PayPalModel.php
Normal file
41
app/Models/paypal/PayPalModel.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php namespace App\Models\paypal;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class PayPalModel extends Model {
|
||||
|
||||
function insertToPaypalDetails($data){
|
||||
|
||||
$i = DB::table('payment_details')->insertGetId($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function insertToOrders($ck){
|
||||
|
||||
// $i = DB::table('orders')->insert($data);
|
||||
$pdo = DB::connection()->getPdo();
|
||||
|
||||
$query = $pdo->prepare("INSERT INTO orders SELECT * FROM cart_tmp where CartKey = '$ck'");
|
||||
$i = $query->execute();
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertShippingAddress($data){
|
||||
|
||||
$i = DB::table('shipping_addresses')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getLastIdPaymentDetails(){
|
||||
|
||||
$i = DB::table('payment_details')
|
||||
->orderby('Id', 'DESC')
|
||||
->take(1)
|
||||
->get();
|
||||
// var_dump($i);
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
231
app/Models/teamstore/TeamStoreModel.php
Normal file
231
app/Models/teamstore/TeamStoreModel.php
Normal file
@@ -0,0 +1,231 @@
|
||||
<?php namespace App\Models\teamstore;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class TeamStoreModel extends Model {
|
||||
|
||||
function selectAllTeamStore() // display all data from database
|
||||
{
|
||||
$i = DB::table('teamstores')
|
||||
->where("IsActive", "true")
|
||||
->orderBy('Id', 'DESC')
|
||||
->paginate(16);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStoreProducts($field, $teamstoreId) // display all data from database
|
||||
{
|
||||
$i = DB::table('teamstore_products')
|
||||
->where($field, $teamstoreId)
|
||||
->orderBy('Ordering', 'ASC')
|
||||
->orderBy('Ordering', 'ASC')->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStoreProductByIdHash($id)
|
||||
{
|
||||
$i = DB::table('teamstore_products')
|
||||
->where(DB::raw('md5(Id)') , $id)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStore($field, $teamstoreURL)
|
||||
{
|
||||
$i = DB::table('teamstores')
|
||||
->where($field, $teamstoreURL)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function checkStorePassword($storeid, $password)
|
||||
{
|
||||
$i = DB::table('teamstores')
|
||||
->where('Id', $storeid)
|
||||
->where('Password', $password)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStoreGroupByCartKey($cartKey)
|
||||
{
|
||||
$i = DB::table('cart_tmp')
|
||||
->where('CartKey', $cartKey)
|
||||
->groupby('CartKey')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function getProductThumbnails($productId){
|
||||
|
||||
$i = DB::table('teamstore_product_thumbnails')
|
||||
->where('ProductId', $productId)
|
||||
->orderby('Ordering', 'ASC')
|
||||
->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)
|
||||
->orderby('Ordering', 'ASC')
|
||||
->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 getSizesByBracket($bracket){
|
||||
|
||||
$i = DB::table('sizes')->select('Size', 'SizeDisplay')
|
||||
->where('Bracket', $bracket)
|
||||
->where('IsActive', 'TRUE')
|
||||
->orderby('Ordering', 'ASC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function insertToCart($data){
|
||||
|
||||
$i = DB::table('cart_tmp')->insert($data);
|
||||
$id = DB::getPdo()->lastInsertId();
|
||||
|
||||
return array(
|
||||
'i' => $i,
|
||||
'lastId' => $id
|
||||
);
|
||||
// return $i;
|
||||
}
|
||||
|
||||
function selectDisplayCartThumb(){
|
||||
|
||||
$i = DB::table('teamstore_product_thumbnails')
|
||||
->where('ImageClass', 'active')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function myCart($cartKey){
|
||||
// echo $cartKey;
|
||||
if($cartKey != ""){
|
||||
$i = DB::table('cart_tmp')
|
||||
->leftjoin('teamstore_voucher', 'cart_tmp.VoucherId', '=', 'teamstore_voucher.Id')
|
||||
->select('cart_tmp.*', 'teamstore_voucher.VoucherCode', 'teamstore_voucher.VoucherType', 'teamstore_voucher.VoucherValue', 'teamstore_voucher.VoucherExpiryDate', 'teamstore_voucher.Status')
|
||||
->where('cart_tmp.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, Price * SUM(Quantity) AS total_price FROM cart_tmp WHERE CartKey = :ck GROUP BY ProductId");
|
||||
$query->execute([':ck'=>$cartKey]);
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
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;
|
||||
}
|
||||
|
||||
function getSoldQty($productId){
|
||||
$i = DB::table('orders')->select(DB::raw('SUM(Quantity) AS SoldQty'))
|
||||
->where('ProductId', $productId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectVoucher($data){
|
||||
$i = DB::table('teamstore_voucher')
|
||||
->where(DB::raw('BINARY `VoucherCode`'), $data['voucher'])
|
||||
->where('TeamStoreId', $data['store_id'])
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectVoucherWhereIn($data){
|
||||
$i = DB::table('teamstore_voucher')
|
||||
->whereIn('Id', $data)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateVoucherValueInCart($data, $id){
|
||||
$i = DB::table('cart_tmp')
|
||||
->where('Id', $id)
|
||||
->update($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamstoreSearch($field, $value, $keyword){
|
||||
|
||||
$i = DB::table('teamstores')
|
||||
->where("StoreName", "LIKE","%$keyword%")
|
||||
->where("IsActive", "true")
|
||||
->orderby($field, $value)
|
||||
->paginate(16);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamstoreFilter($field, $value){
|
||||
|
||||
$i = DB::table('teamstores')
|
||||
->where("IsActive", "true")
|
||||
->orderby($field, $value)
|
||||
->paginate(16);
|
||||
return $i;
|
||||
}
|
||||
|
||||
}
|
||||
384
app/Models/user/UserModel.php
Normal file
384
app/Models/user/UserModel.php
Normal file
@@ -0,0 +1,384 @@
|
||||
<?php namespace App\Models\user;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\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.other_email', '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($field, $val){
|
||||
|
||||
$i = DB::table('payment_details')
|
||||
->where($field, $val)
|
||||
->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)
|
||||
->where('IsActive', 'TRUE')
|
||||
->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;
|
||||
}
|
||||
|
||||
function selectOrderItem($ck){
|
||||
$i = DB::table('orders')
|
||||
->where('CartKey', $ck)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectOrderItemWithStoreId($store_id, $ck){
|
||||
$i = DB::table('orders')
|
||||
->where('StoreId', $store_id)
|
||||
->where('CartKey', $ck)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectOrder($field, $value){
|
||||
$i = DB::table('orders')
|
||||
->where($field, $value)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
// function selectStoreOrders($store_id){
|
||||
// $i = DB::table('orders')->select('orders.*', 'orders.Id as Order_Id', 'payment_details.InvoiceNumber', 'payment_details.Currency', 'payment_details.Payer_Email', 'payment_details.Payer_Firstname', 'payment_details.Payer_Lastname', 'shipping_addresses.*', 'tracking_steps.StepLabel')
|
||||
// ->leftjoin('payment_details', 'payment_details.CartKey','=','orders.CartKey')
|
||||
// ->leftjoin('shipping_addresses', 'shipping_addresses.PaymentDetail_Id','=','payment_details.Id')
|
||||
// ->leftjoin('tracking', 'tracking.InvoiceNumber','=','payment_details.InvoiceNumber')
|
||||
// ->leftjoin('tracking_steps', 'tracking_steps.Id','=','tracking.StepId')
|
||||
// ->where('orders.StoreId', $store_id)
|
||||
// ->orderby('orders.DateCreated', 'DESC')
|
||||
// ->get();
|
||||
// return $i;
|
||||
// }
|
||||
|
||||
function selectStoreOrders($store_id){
|
||||
$i = DB::table('orders')->select('orders.*', 'orders.Id as Order_Id', 'payment_details.InvoiceNumber', 'payment_details.Currency', 'payment_details.Payer_Email', 'payment_details.Payer_Firstname', 'payment_details.Payer_Lastname', 'shipping_addresses.*', DB::raw('(SELECT tracking_steps.StepLabel FROM tracking LEFT JOIN tracking_steps ON tracking_steps.Id = tracking.StepId WHERE tracking.InvoiceNumber = payment_details.InvoiceNumber ORDER BY tracking.Id DESC LIMIT 1 ) AS StepLabel'))
|
||||
->leftjoin('payment_details', 'payment_details.CartKey','=','orders.CartKey')
|
||||
->leftjoin('shipping_addresses', 'shipping_addresses.PaymentDetail_Id','=','payment_details.Id')
|
||||
->where('orders.StoreId', $store_id)
|
||||
->orderby('orders.DateCreated', 'DESC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function itemGroup($cartKey){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, Price * SUM(Quantity) AS total_price FROM orders WHERE CartKey = :ck GROUP BY ProductId");
|
||||
$query->execute([':ck'=>$cartKey]);
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function itemGroupWithStoreId($store_id, $cartKey){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, Price * SUM(Quantity) AS total_price FROM orders WHERE StoreId= :si AND CartKey = :ck GROUP BY ProductId");
|
||||
$query->execute(array(':si'=>$store_id, ':ck'=>$cartKey));
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
return $row;
|
||||
|
||||
}
|
||||
|
||||
function selectDisplayItemThumb(){
|
||||
|
||||
$i = DB::table('teamstore_product_thumbnails')
|
||||
->where('ImageClass', 'active')
|
||||
->orderby('Ordering', 'ASC')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectDisplayItemThumbById($id){
|
||||
|
||||
$i = DB::table('teamstore_product_thumbnails')
|
||||
->where('ProductId', $id)
|
||||
->where('ImageClass', 'active')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function deleteImageThumb($field, $id){
|
||||
$i = DB::table('teamstore_product_thumbnails')
|
||||
->where($field, $id)
|
||||
->delete();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function deleteStoreItem($id){
|
||||
$i = DB::table('teamstore_products')
|
||||
->where('Id', $id)
|
||||
->delete();
|
||||
$this->deleteImageThumb('ProductId', $id);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectItemsStoreId($ck){
|
||||
|
||||
$i = DB::table('cart_tmp')
|
||||
->select(DB::raw('StoreId'))
|
||||
->where('CartKey', $ck)
|
||||
->groupby('StoreId')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function selectUserLogins($field, $value){
|
||||
|
||||
$i = DB::table('user_logins')
|
||||
->where($field, $value)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function insertNewProduct($data){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$i = DB::table('teamstore_products')->insert($data);
|
||||
$id = DB::getPdo()->lastInsertId();
|
||||
return $id;
|
||||
}
|
||||
|
||||
function insertNewProductThumbnails($data){
|
||||
$i = DB::table('teamstore_product_thumbnails')->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateProductCode($data, $id){
|
||||
$i = DB::table('teamstore_products')->where('Id', $id)
|
||||
->update($data);
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectTeamStoreName($ck){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT t.Id, t.StoreName FROM orders AS o INNER JOIN teamstores AS t ON t.Id = o.StoreId WHERE o.CartKey = :ck GROUP BY o.StoreId ORDER BY t.StoreName ASC");
|
||||
$query->execute(array(':ck'=>$ck));
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function updateActiveThumb($id, $product_id){
|
||||
DB::table('teamstore_product_thumbnails')->where('ProductId', $product_id)
|
||||
->update(['ImageClass' => null]);
|
||||
$i = DB::table('teamstore_product_thumbnails')->where('Id', $id)
|
||||
->update(['ImageClass' => 'active']);
|
||||
}
|
||||
|
||||
function updateThumbnailOrdering($order, $id){
|
||||
$i = DB::table('teamstore_product_thumbnails')->where('Id', $id)
|
||||
->update(['Ordering' => $order]);
|
||||
}
|
||||
|
||||
function updateItemOrdering($order, $id){
|
||||
$i = DB::table('teamstore_products')->where('Id', $id)
|
||||
->update(['Ordering' => $order]);
|
||||
}
|
||||
|
||||
function updateTeamstore($id, $data){
|
||||
|
||||
$i = DB::table('teamstores')
|
||||
->where("Id", $id)
|
||||
->update($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectShippingAddress($field, $value){
|
||||
|
||||
$i = DB::table('shipping_addresses')
|
||||
->where($field, $value)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectUserLoginsWhereIn($ids){
|
||||
$i = DB::table('user_logins')
|
||||
->whereIn('store_id', $ids)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function selectShippingCost(){
|
||||
$i = DB::table('shipping_cost')
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
|
||||
function countStoreOrder($storeId){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT SUM(o.Quantity) AS count_order FROM orders AS o WHERE o.StoreId = :storeId");
|
||||
$query->execute([':storeId'=>$storeId]);
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function storeIncome($storeId){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT SUM(o.Price) AS store_income FROM orders AS o WHERE o.StoreId = :storeId");
|
||||
$query->execute([':storeId'=>$storeId]);
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function countStoreProduct($storeId){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT COUNT(Id) AS store_product_count FROM teamstore_products AS tp WHERE tp.TeamStoreId = :storeId");
|
||||
$query->execute([':storeId'=>$storeId]);
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function countStorePublishedProduct($storeId){
|
||||
$pdo = DB::connection()->getPdo();
|
||||
$query = $pdo->prepare("SELECT COUNT(Id) AS store_published_product FROM teamstore_products AS tp WHERE tp.TeamStoreId = :storeId AND PrivacyStatus = 'public'");
|
||||
$query->execute([':storeId'=>$storeId]);
|
||||
$row = $query->fetchAll(\PDO::FETCH_OBJ);
|
||||
return $row;
|
||||
}
|
||||
|
||||
function getAnnouncement($storeId){
|
||||
$i = DB::table('store_announcement')
|
||||
->where('StoreId', $storeId)
|
||||
->get();
|
||||
return $i;
|
||||
}
|
||||
|
||||
function saveNewAnnouncement($data){
|
||||
$i = DB::table('store_announcement')
|
||||
->insert($data);
|
||||
return $i;
|
||||
}
|
||||
|
||||
function updateAnnouncement($id, $data){
|
||||
$i = DB::table('store_announcement')
|
||||
->where('Id', $id)
|
||||
->update($data);
|
||||
return $i;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user