Actualizacion de Diseño Logins y Parte de Registro Negocios
This commit is contained in:
10
desarrollo/app/Models/Addon.php
Normal file
10
desarrollo/app/Models/Addon.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Addon extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
30
desarrollo/app/Models/Address.php
Normal file
30
desarrollo/app/Models/Address.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/AffiliateConfig.php
Normal file
10
desarrollo/app/Models/AffiliateConfig.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AffiliateConfig extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
12
desarrollo/app/Models/AffiliateEarningDetail.php
Normal file
12
desarrollo/app/Models/AffiliateEarningDetail.php
Normal 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);
|
||||
}
|
||||
}
|
||||
23
desarrollo/app/Models/AffiliateLog.php
Normal file
23
desarrollo/app/Models/AffiliateLog.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/AffiliateOption.php
Normal file
10
desarrollo/app/Models/AffiliateOption.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AffiliateOption extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
desarrollo/app/Models/AffiliatePayment.php
Normal file
10
desarrollo/app/Models/AffiliatePayment.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AffiliatePayment extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
desarrollo/app/Models/AffiliateStats.php
Normal file
10
desarrollo/app/Models/AffiliateStats.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AffiliateStats extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
18
desarrollo/app/Models/AffiliateUser.php
Normal file
18
desarrollo/app/Models/AffiliateUser.php
Normal 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);
|
||||
}
|
||||
}
|
||||
12
desarrollo/app/Models/AffiliateWithdrawRequest.php
Normal file
12
desarrollo/app/Models/AffiliateWithdrawRequest.php
Normal 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);
|
||||
}
|
||||
}
|
||||
13
desarrollo/app/Models/AppSettings.php
Normal file
13
desarrollo/app/Models/AppSettings.php
Normal 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);
|
||||
}
|
||||
}
|
||||
13
desarrollo/app/Models/AppTranslation.php
Normal file
13
desarrollo/app/Models/AppTranslation.php
Normal 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 = [];
|
||||
}
|
||||
26
desarrollo/app/Models/Attribute.php
Normal file
26
desarrollo/app/Models/Attribute.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
12
desarrollo/app/Models/AttributeCategory.php
Normal file
12
desarrollo/app/Models/AttributeCategory.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AttributeCategory extends Model
|
||||
{
|
||||
//
|
||||
|
||||
protected $table = "attribute_category";
|
||||
}
|
||||
15
desarrollo/app/Models/AttributeTranslation.php
Normal file
15
desarrollo/app/Models/AttributeTranslation.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
13
desarrollo/app/Models/AttributeValue.php
Normal file
13
desarrollo/app/Models/AttributeValue.php
Normal 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);
|
||||
}
|
||||
}
|
||||
17
desarrollo/app/Models/AuctionProductBid.php
Normal file
17
desarrollo/app/Models/AuctionProductBid.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/Banner.php
Normal file
10
desarrollo/app/Models/Banner.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Banner extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
16
desarrollo/app/Models/Blog.php
Normal file
16
desarrollo/app/Models/Blog.php
Normal 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');
|
||||
}
|
||||
|
||||
}
|
||||
16
desarrollo/app/Models/BlogCategory.php
Normal file
16
desarrollo/app/Models/BlogCategory.php
Normal 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);
|
||||
}
|
||||
}
|
||||
23
desarrollo/app/Models/Brand.php
Normal file
23
desarrollo/app/Models/Brand.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
14
desarrollo/app/Models/BrandTranslation.php
Normal file
14
desarrollo/app/Models/BrandTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/BusinessSetting.php
Normal file
10
desarrollo/app/Models/BusinessSetting.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BusinessSetting extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
24
desarrollo/app/Models/Carrier.php
Normal file
24
desarrollo/app/Models/Carrier.php
Normal 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);
|
||||
}
|
||||
}
|
||||
20
desarrollo/app/Models/CarrierRange.php
Normal file
20
desarrollo/app/Models/CarrierRange.php
Normal 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);
|
||||
}
|
||||
}
|
||||
26
desarrollo/app/Models/CarrierRangePrice.php
Normal file
26
desarrollo/app/Models/CarrierRangePrice.php
Normal 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);
|
||||
}
|
||||
}
|
||||
28
desarrollo/app/Models/Cart.php
Normal file
28
desarrollo/app/Models/Cart.php
Normal 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);
|
||||
}
|
||||
}
|
||||
15
desarrollo/app/Models/CartProduct.php
Normal file
15
desarrollo/app/Models/CartProduct.php
Normal 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);
|
||||
}
|
||||
}
|
||||
49
desarrollo/app/Models/Category.php
Normal file
49
desarrollo/app/Models/Category.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/CategoryTranslation.php
Normal file
14
desarrollo/app/Models/CategoryTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
29
desarrollo/app/Models/City.php
Normal file
29
desarrollo/app/Models/City.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/CityTranslation.php
Normal file
14
desarrollo/app/Models/CityTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
20
desarrollo/app/Models/ClubPoint.php
Normal file
20
desarrollo/app/Models/ClubPoint.php
Normal 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);
|
||||
}
|
||||
}
|
||||
18
desarrollo/app/Models/ClubPointDetail.php
Normal file
18
desarrollo/app/Models/ClubPointDetail.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/Color.php
Normal file
10
desarrollo/app/Models/Color.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Color extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
16
desarrollo/app/Models/CombinedOrder.php
Normal file
16
desarrollo/app/Models/CombinedOrder.php
Normal 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);
|
||||
}
|
||||
}
|
||||
12
desarrollo/app/Models/CommissionHistory.php
Normal file
12
desarrollo/app/Models/CommissionHistory.php
Normal 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');
|
||||
}
|
||||
}
|
||||
20
desarrollo/app/Models/Conversation.php
Normal file
20
desarrollo/app/Models/Conversation.php
Normal 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');
|
||||
}
|
||||
}
|
||||
19
desarrollo/app/Models/Country.php
Normal file
19
desarrollo/app/Models/Country.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
16
desarrollo/app/Models/Coupon.php
Normal file
16
desarrollo/app/Models/Coupon.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/CouponUsage.php
Normal file
10
desarrollo/app/Models/CouponUsage.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CouponUsage extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
desarrollo/app/Models/Currency.php
Normal file
10
desarrollo/app/Models/Currency.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Currency extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
15
desarrollo/app/Models/Customer.php
Normal file
15
desarrollo/app/Models/Customer.php
Normal 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);
|
||||
}
|
||||
}
|
||||
30
desarrollo/app/Models/CustomerPackage.php
Normal file
30
desarrollo/app/Models/CustomerPackage.php
Normal 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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
16
desarrollo/app/Models/CustomerPackagePayment.php
Normal file
16
desarrollo/app/Models/CustomerPackagePayment.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/CustomerPackageTranslation.php
Normal file
14
desarrollo/app/Models/CustomerPackageTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
64
desarrollo/app/Models/CustomerProduct.php
Normal file
64
desarrollo/app/Models/CustomerProduct.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/CustomerProductTranslation.php
Normal file
14
desarrollo/app/Models/CustomerProductTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
18
desarrollo/app/Models/CustomersImport.php
Normal file
18
desarrollo/app/Models/CustomersImport.php
Normal 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'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
12
desarrollo/app/Models/DeliveryBoy.php
Normal file
12
desarrollo/app/Models/DeliveryBoy.php
Normal 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);
|
||||
}
|
||||
}
|
||||
15
desarrollo/app/Models/DeliveryBoyCollection.php
Normal file
15
desarrollo/app/Models/DeliveryBoyCollection.php
Normal 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);
|
||||
}
|
||||
}
|
||||
15
desarrollo/app/Models/DeliveryBoyPayment.php
Normal file
15
desarrollo/app/Models/DeliveryBoyPayment.php
Normal 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);
|
||||
}
|
||||
}
|
||||
13
desarrollo/app/Models/DeliveryHistory.php
Normal file
13
desarrollo/app/Models/DeliveryHistory.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/FirebaseNotification.php
Normal file
10
desarrollo/app/Models/FirebaseNotification.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FirebaseNotification extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
26
desarrollo/app/Models/FlashDeal.php
Normal file
26
desarrollo/app/Models/FlashDeal.php
Normal 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);
|
||||
}
|
||||
}
|
||||
15
desarrollo/app/Models/FlashDealProduct.php
Normal file
15
desarrollo/app/Models/FlashDealProduct.php
Normal 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);
|
||||
}
|
||||
}
|
||||
15
desarrollo/app/Models/FlashDealTranslation.php
Normal file
15
desarrollo/app/Models/FlashDealTranslation.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
15
desarrollo/app/Models/FollowSeller.php
Normal file
15
desarrollo/app/Models/FollowSeller.php
Normal 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);
|
||||
}
|
||||
}
|
||||
11
desarrollo/app/Models/Language.php
Normal file
11
desarrollo/app/Models/Language.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App;
|
||||
|
||||
class Language extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
desarrollo/app/Models/ManualPaymentMethod.php
Normal file
10
desarrollo/app/Models/ManualPaymentMethod.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ManualPaymentMethod extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
}
|
||||
16
desarrollo/app/Models/Message.php
Normal file
16
desarrollo/app/Models/Message.php
Normal 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);
|
||||
}
|
||||
}
|
||||
22
desarrollo/app/Models/NfcVoucher.php
Normal file
22
desarrollo/app/Models/NfcVoucher.php
Normal 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',
|
||||
];
|
||||
}
|
||||
58
desarrollo/app/Models/Order.php
Normal file
58
desarrollo/app/Models/Order.php
Normal 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');
|
||||
}
|
||||
}
|
||||
33
desarrollo/app/Models/OrderDetail.php
Normal file
33
desarrollo/app/Models/OrderDetail.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/OtpConfiguration.php
Normal file
10
desarrollo/app/Models/OtpConfiguration.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OtpConfiguration extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
19
desarrollo/app/Models/Page.php
Normal file
19
desarrollo/app/Models/Page.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/PageTranslation.php
Normal file
14
desarrollo/app/Models/PageTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/PasswordReset.php
Normal file
10
desarrollo/app/Models/PasswordReset.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PasswordReset extends Model
|
||||
{
|
||||
protected $fillable = ['email', 'token'];
|
||||
}
|
||||
10
desarrollo/app/Models/Payment.php
Normal file
10
desarrollo/app/Models/Payment.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Payment extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
desarrollo/app/Models/Permission.php
Normal file
10
desarrollo/app/Models/Permission.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Permission extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
25
desarrollo/app/Models/PickupPoint.php
Normal file
25
desarrollo/app/Models/PickupPoint.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/PickupPointTranslation.php
Normal file
14
desarrollo/app/Models/PickupPointTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/Policy.php
Normal file
10
desarrollo/app/Models/Policy.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Policy extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
86
desarrollo/app/Models/Product.php
Normal file
86
desarrollo/app/Models/Product.php
Normal 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);
|
||||
}
|
||||
}
|
||||
19
desarrollo/app/Models/ProductQuery.php
Normal file
19
desarrollo/app/Models/ProductQuery.php
Normal 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');
|
||||
}
|
||||
}
|
||||
18
desarrollo/app/Models/ProductStock.php
Normal file
18
desarrollo/app/Models/ProductStock.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/ProductTax.php
Normal file
10
desarrollo/app/Models/ProductTax.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProductTax extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
14
desarrollo/app/Models/ProductTranslation.php
Normal file
14
desarrollo/app/Models/ProductTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
65
desarrollo/app/Models/ProductsExport.php
Normal file
65
desarrollo/app/Models/ProductsExport.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
||||
123
desarrollo/app/Models/ProductsImport.php
Normal file
123
desarrollo/app/Models/ProductsImport.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/ProxyPayment.php
Normal file
10
desarrollo/app/Models/ProxyPayment.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProxyPayment extends Model
|
||||
{
|
||||
protected $table = 'proxypay_payments';
|
||||
}
|
||||
28
desarrollo/app/Models/RefundRequest.php
Normal file
28
desarrollo/app/Models/RefundRequest.php
Normal 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);
|
||||
}
|
||||
}
|
||||
16
desarrollo/app/Models/Review.php
Normal file
16
desarrollo/app/Models/Review.php
Normal 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);
|
||||
}
|
||||
}
|
||||
21
desarrollo/app/Models/Role.php
Normal file
21
desarrollo/app/Models/Role.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/RoleTranslation.php
Normal file
14
desarrollo/app/Models/RoleTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/Search.php
Normal file
10
desarrollo/app/Models/Search.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Search extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
23
desarrollo/app/Models/Seller.php
Normal file
23
desarrollo/app/Models/Seller.php
Normal 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);
|
||||
}
|
||||
}
|
||||
32
desarrollo/app/Models/SellerPackage.php
Normal file
32
desarrollo/app/Models/SellerPackage.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
16
desarrollo/app/Models/SellerPackagePayment.php
Normal file
16
desarrollo/app/Models/SellerPackagePayment.php
Normal 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);
|
||||
}
|
||||
}
|
||||
14
desarrollo/app/Models/SellerPackageTranslation.php
Normal file
14
desarrollo/app/Models/SellerPackageTranslation.php
Normal 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);
|
||||
}
|
||||
}
|
||||
17
desarrollo/app/Models/SellerWithdrawRequest.php
Normal file
17
desarrollo/app/Models/SellerWithdrawRequest.php
Normal 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);
|
||||
}
|
||||
}
|
||||
31
desarrollo/app/Models/Shop.php
Normal file
31
desarrollo/app/Models/Shop.php
Normal 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';
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/Slider.php
Normal file
10
desarrollo/app/Models/Slider.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Slider extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
10
desarrollo/app/Models/SmsTemplate.php
Normal file
10
desarrollo/app/Models/SmsTemplate.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SmsTemplate extends Model
|
||||
{
|
||||
protected $guarded = [];
|
||||
}
|
||||
24
desarrollo/app/Models/Staff.php
Normal file
24
desarrollo/app/Models/Staff.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
19
desarrollo/app/Models/State.php
Normal file
19
desarrollo/app/Models/State.php
Normal 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);
|
||||
}
|
||||
}
|
||||
43
desarrollo/app/Models/SubCategory.php
Normal file
43
desarrollo/app/Models/SubCategory.php
Normal 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);
|
||||
}
|
||||
}
|
||||
43
desarrollo/app/Models/SubSubCategory.php
Normal file
43
desarrollo/app/Models/SubSubCategory.php
Normal 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);
|
||||
}
|
||||
}
|
||||
10
desarrollo/app/Models/Subscriber.php
Normal file
10
desarrollo/app/Models/Subscriber.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Subscriber extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
12
desarrollo/app/Models/Tax.php
Normal file
12
desarrollo/app/Models/Tax.php
Normal 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
Reference in New Issue
Block a user