Actualizacion de Diseño Logins y Parte de Registro Negocios

This commit is contained in:
kquiroz
2023-08-23 16:11:21 -04:00
parent d71e89adae
commit 38bf59042d
3498 changed files with 691264 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Addon extends Model
{
//
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Address extends Model
{
protected $fillable = ['set_default'];
public function user()
{
return $this->belongsTo(User::class);
}
public function country()
{
return $this->belongsTo(Country::class);
}
public function state()
{
return $this->belongsTo(State::class);
}
public function city()
{
return $this->belongsTo(City::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliateConfig extends Model
{
//
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliateEarningDetail extends Model
{
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliateLog extends Model
{
public function user()
{
return $this->belongsTo(User::class);
}
public function order_detail()
{
return $this->belongsTo(OrderDetail::class);
}
public function order()
{
return $this->belongsTo(Order::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliateOption extends Model
{
//
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliatePayment extends Model
{
//
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliateStats extends Model
{
//
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliateUser extends Model
{
//
public function user(){
return $this->belongsTo(User::class);
}
public function affiliate_payments()
{
return $this->hasMany(AffiliatePayment::class)->orderBy('created_at', 'desc')->paginate(12);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AffiliateWithdrawRequest extends Model
{
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AppSettings extends Model
{
public function currency()
{
return $this->belongsTo(Currency::class);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AppTranslation extends Model
{
use HasFactory;
protected $guarded = [];
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class Attribute extends Model
{
protected $with = ['attribute_translations'];
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$attribute_translation = $this->attribute_translations->where('lang', $lang)->first();
return $attribute_translation != null ? $attribute_translation->$field : $this->$field;
}
public function attribute_translations(){
return $this->hasMany(AttributeTranslation::class);
}
public function attribute_values() {
return $this->hasMany(AttributeValue::class);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AttributeCategory extends Model
{
//
protected $table = "attribute_category";
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AttributeTranslation extends Model
{
protected $fillable = ['name', 'lang', 'attribute_id'];
public function attribute(){
return $this->belongsTo(Attribute::class);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AttributeValue extends Model
{
public function attribute() {
return $this->belongsTo(Attribute::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class AuctionProductBid extends Model
{
public function product(){
return $this->belongsTo(Product::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Banner extends Model
{
//
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Blog extends Model
{
use SoftDeletes;
public function category() {
return $this->belongsTo(BlogCategory::class, 'category_id');
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class BlogCategory extends Model
{
use SoftDeletes;
public function posts()
{
return $this->hasMany(Blog::class);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class Brand extends Model
{
protected $with = ['brand_translations'];
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$brand_translation = $this->brand_translations->where('lang', $lang)->first();
return $brand_translation != null ? $brand_translation->$field : $this->$field;
}
public function brand_translations(){
return $this->hasMany(BrandTranslation::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BrandTranslation extends Model
{
protected $fillable = ['name', 'lang', 'brand_id'];
public function brand(){
return $this->belongsTo(Brand::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BusinessSetting extends Model
{
//
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Carrier extends Model
{
use HasFactory;
public function carrier_ranges(){
return $this->hasMany(CarrierRange::class);
}
public function carrier_range_prices(){
return $this->hasMany(CarrierRangePrice::class);
}
public function scopeActive($query)
{
return $query->where('status', 1);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CarrierRange extends Model
{
use HasFactory;
public function carrier()
{
return $this->belongsTo(Carrier::class);
}
public function carrier_range_prices(){
return $this->hasMany(CarrierRangePrice::class);
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CarrierRangePrice extends Model
{
use HasFactory;
public function carrier()
{
return $this->belongsTo(Carrier::class);
}
public function carrier_ranges()
{
return $this->belongsTo(CarrierRange::class);
}
public function zone()
{
return $this->belongsTo(Zone::class);
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use App\Models\User;
use App\Models\Address;
use Illuminate\Database\Eloquent\Model;
class Cart extends Model
{
protected $guarded = [];
protected $fillable = ['address_id','price','tax','shipping_cost','discount','product_referral_code','coupon_code','coupon_applied','quantity','user_id','temp_user_id','owner_id','product_id','variation'];
public function user()
{
return $this->belongsTo(User::class);
}
public function product()
{
return $this->belongsTo(Product::class);
}
public function address()
{
return $this->belongsTo(Address::class);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CartProduct extends Model
{
protected $guarded = [];
public function product()
{
return $this->belongsTo(Product::class);
}
}

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class Category extends Model
{
protected $with = ['category_translations'];
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$category_translation = $this->category_translations->where('lang', $lang)->first();
return $category_translation != null ? $category_translation->$field : $this->$field;
}
public function category_translations(){
return $this->hasMany(CategoryTranslation::class);
}
public function products(){
return $this->hasMany(Product::class);
}
public function classified_products(){
return $this->hasMany(CustomerProduct::class);
}
public function categories()
{
return $this->hasMany(Category::class, 'parent_id');
}
public function childrenCategories()
{
return $this->hasMany(Category::class, 'parent_id')->with('categories');
}
public function parentCategory()
{
return $this->belongsTo(Category::class, 'parent_id');
}
public function attributes()
{
return $this->belongsToMany(Attribute::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CategoryTranslation extends Model
{
protected $fillable = ['name', 'lang', 'category_id'];
public function category(){
return $this->belongsTo(Category::class);
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class City extends Model
{
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$city_translation = $this->hasMany(CityTranslation::class)->where('lang', $lang)->first();
return $city_translation != null ? $city_translation->$field : $this->$field;
}
public function city_translations(){
return $this->hasMany(CityTranslation::class);
}
public function country()
{
return $this->belongsTo(Country::class);
}
public function state()
{
return $this->belongsTo(State::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CityTranslation extends Model
{
protected $fillable = ['name', 'lang', 'city_id'];
public function city(){
return $this->belongsTo(City::class);
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ClubPoint extends Model
{
public function user(){
return $this->belongsTo(User::class);
}
public function order(){
return $this->belongsTo(Order::class);
}
public function club_point_details(){
return $this->hasMany(ClubPointDetail::class);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ClubPointDetail extends Model
{
public function product()
{
return $this->belongsTo(Product::class);
}
public function club_point()
{
return $this->belongsTo(ClubPoint::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Color extends Model
{
//
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CombinedOrder extends Model
{
public function orders(){
return $this->hasMany(Order::class);
}
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CommissionHistory extends Model
{
public function order() {
return $this->hasOne(Order::class, 'id', 'order_id');
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Conversation extends Model
{
public function messages(){
return $this->hasMany(Message::class);
}
public function sender(){
return $this->belongsTo(User::class, 'sender_id');
}
public function receiver(){
return $this->belongsTo(User::class, 'receiver_id');
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Country extends Model
{
/**
* Get the Zone that owns the Country
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function zone()
{
return $this->belongsTo(Zone::class);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Coupon extends Model
{
protected $fillable = [
'user_id', 'type', 'code','details','discount', 'discount_type', 'start_date', 'end_date'
];
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CouponUsage extends Model
{
//
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Currency extends Model
{
//
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
protected $fillable = [
'user_id',
];
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class CustomerPackage extends Model
{
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$brand_translation = $this->hasMany(CustomerPackageTranslation::class)->where('lang', $lang)->first();
return $brand_translation != null ? $brand_translation->$field : $this->$field;
}
public function customer_package_translations(){
return $this->hasMany(CustomerPackageTranslation::class);
}
public function customer_package_payments()
{
return $this->hasMany(CustomerPackagePayment::class);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CustomerPackagePayment extends Model
{
public function user(){
return $this->belongsTo(User::class);
}
public function customer_package(){
return $this->belongsTo(CustomerPackage::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CustomerPackageTranslation extends Model
{
protected $fillable = ['name', 'lang', 'customer_package_id'];
public function customer_package(){
return $this->belongsTo(CustomerPackage::class);
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class CustomerProduct extends Model
{
protected $with = ['customer_product_translations'];
public function getTranslation($field = '', $lang = false)
{
$lang = $lang == false ? App::getLocale() : $lang;
$customer_product_translations = $this->customer_product_translations->where('lang', $lang)->first();
return $customer_product_translations != null ? $customer_product_translations->$field : $this->$field;
}
public function scopeIsActiveAndApproval($query)
{
return $query->where('status', '1')
->where('published', '1');
}
public function category()
{
return $this->belongsTo(Category::class);
}
public function subcategory()
{
return $this->belongsTo(SubCategory::class);
}
public function subsubcategory()
{
return $this->belongsTo(SubSubCategory::class);
}
public function brand()
{
return $this->belongsTo(Brand::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function state()
{
return $this->belongsTo(State::class);
}
public function city()
{
return $this->belongsTo(City::class);
}
public function customer_product_translations()
{
return $this->hasMany(CustomerProductTranslation::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CustomerProductTranslation extends Model
{
protected $fillable = ['customer_product_id', 'name', 'lang'];
public function customer_product(){
return $this->belongsTo(CustomerProduct::class);
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use App\Models\Customer;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Illuminate\Support\Facades\Hash;
class CustomersImport implements ToModel, WithHeadingRow
{
public function model(array $row)
{
return new Customer([
'user_id' => $row['user_id'],
]);
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DeliveryBoy extends Model
{
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class DeliveryBoyCollection extends Model
{
use HasFactory;
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class DeliveryBoyPayment extends Model
{
use HasFactory;
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class DeliveryHistory extends Model
{
public function order()
{
return $this->belongsTo(Order::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class FirebaseNotification extends Model
{
//
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class FlashDeal extends Model
{
protected $with = ['flash_deal_translations'];
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$flash_deal_translation = $this->flash_deal_translations->where('lang', $lang)->first();
return $flash_deal_translation != null ? $flash_deal_translation->$field : $this->$field;
}
public function flash_deal_translations(){
return $this->hasMany(FlashDealTranslation::class);
}
public function flash_deal_products()
{
return $this->hasMany(FlashDealProduct::class);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class FlashDealProduct extends Model
{
protected $fillable=['flash_deal_id', 'product_id'];
public function product()
{
return $this->belongsTo(Product::class);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class FlashDealTranslation extends Model
{
protected $fillable = ['title', 'lang', 'flash_deal_id'];
public function flash_deal(){
return $this->belongsTo(FlashDeal::class);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class FollowSeller extends Model
{
protected $guarded = [];
public function shop()
{
return $this->belongsTo(Shop::class);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class Language extends Model
{
//
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ManualPaymentMethod extends Model
{
protected $guarded = [];
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Message extends Model
{
public function conversation(){
return $this->belongsTo(Conversation::class);
}
public function user(){
return $this->belongsTo(User::class);
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class NfcVoucher extends Model
{
use HasFactory;
protected $fillable = [
'nfc_type',
'nfc_following',
'nfc_expiration',
'nfc_amount',
'nfc_next',
'nfc_select',
'nfc_used',
'user_id',
];
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
public function orderDetails()
{
return $this->hasMany(OrderDetail::class);
}
public function refund_requests()
{
return $this->hasMany(RefundRequest::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function shop()
{
return $this->hasOne(Shop::class, 'user_id', 'seller_id');
}
public function pickup_point()
{
return $this->belongsTo(PickupPoint::class);
}
public function carrier()
{
return $this->belongsTo(Carrier::class);
}
public function affiliate_log()
{
return $this->hasMany(AffiliateLog::class);
}
public function club_point()
{
return $this->hasMany(ClubPoint::class);
}
public function delivery_boy()
{
return $this->belongsTo(User::class, 'assign_delivery_boy', 'id');
}
public function proxy_cart_reference_id()
{
return $this->hasMany(ProxyPayment::class)->select('reference_id');
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OrderDetail extends Model
{
public function order()
{
return $this->belongsTo(Order::class);
}
public function product()
{
return $this->belongsTo(Product::class);
}
public function pickup_point()
{
return $this->belongsTo(PickupPoint::class);
}
public function refund_request()
{
return $this->hasOne(RefundRequest::class);
}
public function affiliate_log()
{
return $this->hasMany(AffiliateLog::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class OtpConfiguration extends Model
{
//
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class Page extends Model
{
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$page_translation = $this->hasMany(PageTranslation::class)->where('lang', $lang)->first();
return $page_translation != null ? $page_translation->$field : $this->$field;
}
public function page_translations(){
return $this->hasMany(PageTranslation::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PageTranslation extends Model
{
protected $fillable = ['page_id', 'title', 'content', 'lang'];
public function page(){
return $this->belongsTo(Page::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PasswordReset extends Model
{
protected $fillable = ['email', 'token'];
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Payment extends Model
{
//
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Permission extends Model
{
//
}

View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class PickupPoint extends Model
{
protected $with = ['pickup_point_translations'];
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$pickup_point_translation = $this->pickup_point_translations->where('lang', $lang)->first();
return $pickup_point_translation != null ? $pickup_point_translation->$field : $this->$field;
}
public function pickup_point_translations(){
return $this->hasMany(PickupPointTranslation::class);
}
public function staff(){
return $this->belongsTo(Staff::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PickupPointTranslation extends Model
{
protected $fillable = ['name', 'address', 'lang', 'pickup_point_id'];
public function poickup_point(){
return $this->belongsTo(PickupPoint::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Policy extends Model
{
//
}

View File

@@ -0,0 +1,86 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class Product extends Model
{
protected $guarded = ['choice_attributes'];
protected $with = ['product_translations', 'taxes'];
public function getTranslation($field = '', $lang = false)
{
$lang = $lang == false ? App::getLocale() : $lang;
$product_translations = $this->product_translations->where('lang', $lang)->first();
return $product_translations != null ? $product_translations->$field : $this->$field;
}
public function product_translations()
{
return $this->hasMany(ProductTranslation::class);
}
public function category()
{
return $this->belongsTo(Category::class);
}
public function brand()
{
return $this->belongsTo(Brand::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function orderDetails()
{
return $this->hasMany(OrderDetail::class);
}
public function reviews()
{
return $this->hasMany(Review::class)->where('status', 1);
}
public function wishlists()
{
return $this->hasMany(Wishlist::class);
}
public function stocks()
{
return $this->hasMany(ProductStock::class);
}
public function taxes()
{
return $this->hasMany(ProductTax::class);
}
public function flash_deal_product()
{
return $this->hasOne(FlashDealProduct::class);
}
public function bids()
{
return $this->hasMany(AuctionProductBid::class);
}
public function scopePhysical($query)
{
return $query->where('digital', 0);
}
public function scopeDigital($query)
{
return $query->where('digital', 1);
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProductQuery extends Model
{
use HasFactory;
public function product(){
return $this->belongsTo(Product::class);
}
public function user(){
return $this->belongsTo(User::class,'customer_id');
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ProductStock extends Model
{
protected $fillable = ['product_id', 'variant', 'sku', 'price', 'qty', 'image'];
//
public function product(){
return $this->belongsTo(Product::class);
}
public function wholesalePrices() {
return $this->hasMany(WholesalePrice::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ProductTax extends Model
{
//
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ProductTranslation extends Model
{
protected $fillable = ['product_id', 'name', 'unit', 'description', 'lang'];
public function product(){
return $this->belongsTo(Product::class);
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Models;
use App\Models\Product;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\WithMapping;
use Maatwebsite\Excel\Concerns\WithHeadings;
class ProductsExport implements FromCollection, WithMapping, WithHeadings
{
public function collection()
{
return Product::all();
}
public function headings(): array
{
return [
'name',
'description',
'added_by',
'user_id',
'category_id',
'brand_id',
'video_provider',
'video_link',
'unit_price',
'purchase_price',
'unit',
'current_stock',
'meta_title',
'meta_description',
];
}
/**
* @var Product $product
*/
public function map($product): array
{
$qty = 0;
foreach ($product->stocks as $key => $stock) {
$qty += $stock->qty;
}
return [
$product->name,
$product->description,
$product->added_by,
$product->user_id,
$product->category_id,
$product->brand_id,
$product->video_provider,
$product->video_link,
$product->unit_price,
$product->purchase_price,
$product->unit,
// $product->current_stock,
$qty,
$product->meta_title,
$product->meta_description,
];
}
}

View File

@@ -0,0 +1,123 @@
<?php
namespace App\Models;
use App\Models\Product;
use App\Models\ProductStock;
use App\Models\User;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithValidation;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;
use Illuminate\Support\Str;
use Auth;
use Carbon\Carbon;
use Storage;
//class ProductsImport implements ToModel, WithHeadingRow, WithValidation
class ProductsImport implements ToCollection, WithHeadingRow, WithValidation, ToModel
{
private $rows = 0;
public function collection(Collection $rows)
{
$canImport = true;
$user = Auth::user();
if ($user->user_type == 'seller' && addon_is_activated('seller_subscription')) {
if ((count($rows) + $user->products()->count()) > $user->shop->product_upload_limit
|| $user->shop->package_invalid_at == null
|| Carbon::now()->diffInDays(Carbon::parse($user->shop->package_invalid_at), false) < 0
) {
$canImport = false;
flash(translate('Please upgrade your package.'))->warning();
}
}
if ($canImport) {
foreach ($rows as $row) {
$approved = 1;
if ($user->user_type == 'seller' && get_setting('product_approve_by_admin') == 1) {
$approved = 0;
}
$productId = Product::create([
'name' => $row['name'],
'description' => $row['description'],
'added_by' => $user->user_type == 'seller' ? 'seller' : 'admin',
'user_id' => $user->user_type == 'seller' ? $user->id : User::where('user_type', 'admin')->first()->id,
'approved' => $approved,
'category_id' => $row['category_id'],
'brand_id' => $row['brand_id'],
'video_provider' => $row['video_provider'],
'video_link' => $row['video_link'],
'tags' => $row['tags'],
'unit_price' => $row['unit_price'],
'unit' => $row['unit'],
'meta_title' => $row['meta_title'],
'meta_description' => $row['meta_description'],
'colors' => json_encode(array()),
'choice_options' => json_encode(array()),
'variations' => json_encode(array()),
'slug' => preg_replace('/[^A-Za-z0-9\-]/', '', str_replace(' ', '-', strtolower($row['slug']))) . '-' . Str::random(5),
'thumbnail_img' => $this->downloadThumbnail($row['thumbnail_img']),
'photos' => $this->downloadGalleryImages($row['photos']),
]);
ProductStock::create([
'product_id' => $productId->id,
'qty' => $row['current_stock'],
'price' => $row['unit_price'],
'sku' => $row['sku'],
'variant' => '',
]);
}
flash(translate('Products imported successfully'))->success();
}
}
public function model(array $row)
{
++$this->rows;
}
public function getRowCount(): int
{
return $this->rows;
}
public function rules(): array
{
return [
// Can also use callback validation rules
'unit_price' => function ($attribute, $value, $onFailure) {
if (!is_numeric($value)) {
$onFailure('Unit price is not numeric');
}
}
];
}
public function downloadThumbnail($url)
{
try {
$upload = new Upload;
$upload->external_link = $url;
$upload->type = 'image';
$upload->save();
return $upload->id;
} catch (\Exception $e) {
}
return null;
}
public function downloadGalleryImages($urls)
{
$data = array();
foreach (explode(',', str_replace(' ', '', $urls)) as $url) {
$data[] = $this->downloadThumbnail($url);
}
return implode(',', $data);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ProxyPayment extends Model
{
protected $table = 'proxypay_payments';
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class RefundRequest extends Model
{
public function orderDetail()
{
return $this->belongsTo(OrderDetail::class);
}
public function user()
{
return $this->belongsTo(User::class);
}
public function seller()
{
return $this->belongsTo(User::class, 'seller_id');
}
public function order()
{
return $this->belongsTo(Order::class);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Review extends Model
{
public function user(){
return $this->belongsTo(User::class);
}
public function product(){
return $this->belongsTo(Product::class);
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class Role extends Model
{
protected $with = ['role_translations'];
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$role_translation = $this->role_translations->where('lang', $lang)->first();
return $role_translation != null ? $role_translation->$field : $this->$field;
}
public function role_translations(){
return $this->hasMany(RoleTranslation::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class RoleTranslation extends Model
{
protected $fillable = ['name', 'lang', 'role_id'];
public function role(){
return $this->belongsTo(Role::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Search extends Model
{
//
}

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Seller extends Model
{
protected $with = ['user', 'user.shop'];
public function user(){
return $this->belongsTo(User::class);
}
public function payments(){
return $this->hasMany(Payment::class);
}
public function seller_package(){
return $this->belongsTo(SellerPackage::class);
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App;
class SellerPackage extends Model
{
protected $guarded = [];
public function getTranslation($field = '', $lang = false){
$lang = $lang == false ? App::getLocale() : $lang;
$seller_package_translation = $this->hasMany(SellerPackageTranslation::class)->where('lang', $lang)->first();
return $seller_package_translation != null ? $seller_package_translation->$field : $this->$field;
}
public function seller_package_translations(){
return $this->hasMany(SellerPackageTranslation::class);
}
public function seller_package_payments()
{
return $this->hasMany(SelllerPackagePayment::class);
}
public function shop()
{
return $this->hasOne(Shop::class);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SellerPackagePayment extends Model
{
public function user(){
return $this->belongsTo(User::class);
}
public function seller_package(){
return $this->belongsTo(SellerPackage::class);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SellerPackageTranslation extends Model
{
protected $fillable = ['name', 'lang', 'seller_package_id'];
public function seller_package(){
return $this->belongsTo(SellerPackage::class);
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SellerWithdrawRequest extends Model
{
public function user()
{
return $this->belongsTo(User::class);
}
public function shop()
{
return $this->belongsTo(Shop::class);
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Shop extends Model
{
protected $with = ['user'];
protected $fillable = ['name', 'address', 'user_id'];
public function user()
{
return $this->belongsTo(User::class);
}
public function seller_package(){
return $this->belongsTo(SellerPackage::class);
}
public function followers(){
return $this->hasMany(FollowSeller::class);
}
//URL AMIGABLES
public function getRouteKeyName()
{
return 'slug';
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Slider extends Model
{
//
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SmsTemplate extends Model
{
protected $guarded = [];
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Staff extends Model
{
public function user()
{
return $this->belongsTo(User::class);
}
public function role()
{
return $this->belongsTo(Role::class);
}
public function pick_up_point()
{
return $this->hasOne(PickupPoint::class);
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class State extends Model
{
use HasFactory;
public function country(){
return $this->belongsTo(Country::class);
}
public function cities(){
return $this->hasMany(City::class);
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* App\Models\SubCategory
*
* @property int $id
* @property string $name
* @property int $category_id
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory whereCategoryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubCategory whereUpdatedAt($value)
* @mixin \Eloquent
*/
class SubCategory extends Model
{
public function category()
{
return $this->belongsTo(Category::class);
}
public function products()
{
return $this->hasMany(Product::class);
}
public function subSubCategories()
{
return $this->hasMany(SubSubCategory::class);
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
/**
* App\Models\SubSubCategory
*
* @property int $id
* @property int $sub_category_id
* @property string $name
* @property string $brands
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereBrands($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereSubCategoryId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SubSubCategory whereUpdatedAt($value)
* @mixin \Eloquent
*/
class SubSubCategory extends Model
{
protected static function boot()
{
parent::boot();
static::addGlobalScope('alphabetical', function (Builder $builder) {
$builder->orderBy('name', 'asc');
});
}
public function subCategory()
{
return $this->belongsTo(SubCategory::class);
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Subscriber extends Model
{
//
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Tax extends Model
{
public function product_taxes() {
return $this->hasMany(ProductTax::class);
}
}

Some files were not shown because too many files have changed in this diff Show More