Initial Commit
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user