Initial Commit
This commit is contained in:
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