Actualizacuion de Rama Kquiroz
This commit is contained in:
19
desarrollo/app/Models/Buyer.php
Normal file
19
desarrollo/app/Models/Buyer.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Buyer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'address',
|
||||
'delivery_pickup_latitude',
|
||||
'delivery_pickup_latitude',
|
||||
'user_id'
|
||||
];
|
||||
}
|
||||
@@ -19,6 +19,10 @@ class Category extends Model
|
||||
return $this->hasMany(CategoryTranslation::class);
|
||||
}
|
||||
|
||||
public function coverImage(){
|
||||
return $this->belongsTo(Upload::class, 'cover_image');
|
||||
}
|
||||
|
||||
public function products(){
|
||||
return $this->hasMany(Product::class);
|
||||
}
|
||||
|
||||
@@ -6,14 +6,19 @@ 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);
|
||||
}
|
||||
/**
|
||||
* Get the Zone that owns the Country
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function zone()
|
||||
{
|
||||
return $this->belongsTo(Zone::class);
|
||||
}
|
||||
|
||||
public function scopeIsEnabled($query)
|
||||
{
|
||||
return $query->where('status', '1');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,4 +23,10 @@ class FlashDeal extends Model
|
||||
{
|
||||
return $this->hasMany(FlashDealProduct::class);
|
||||
}
|
||||
|
||||
public function scopeIsActiveAndFeatured($query)
|
||||
{
|
||||
return $query->where('status', '1')
|
||||
->where('featured', '1');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,4 +22,9 @@ class PickupPoint extends Model
|
||||
public function staff(){
|
||||
return $this->belongsTo(Staff::class);
|
||||
}
|
||||
|
||||
public function scopeIsActive($query)
|
||||
{
|
||||
return $query->where('pick_up_status', '1');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
|
||||
protected $guarded = ['choice_attributes'];
|
||||
|
||||
protected $with = ['product_translations', 'taxes'];
|
||||
protected $with = ['product_translations', 'taxes', 'thumbnail'];
|
||||
|
||||
public function getTranslation($field = '', $lang = false)
|
||||
{
|
||||
@@ -74,6 +74,11 @@ class Product extends Model
|
||||
return $this->hasMany(AuctionProductBid::class);
|
||||
}
|
||||
|
||||
public function thumbnail()
|
||||
{
|
||||
return $this->belongsTo(Upload::class, 'thumbnail_img');
|
||||
}
|
||||
|
||||
public function scopePhysical($query)
|
||||
{
|
||||
return $query->where('digital', 0);
|
||||
@@ -83,4 +88,14 @@ class Product extends Model
|
||||
{
|
||||
return $query->where('digital', 1);
|
||||
}
|
||||
|
||||
public function carts()
|
||||
{
|
||||
return $this->hasMany(Cart::class);
|
||||
}
|
||||
|
||||
public function scopeIsApprovedPublished($query)
|
||||
{
|
||||
return $query->where('approved', '1')->where('published', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class ProductsExport implements FromCollection, WithMapping, WithHeadings
|
||||
'purchase_price',
|
||||
'unit',
|
||||
'current_stock',
|
||||
'est_shipping_days',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
];
|
||||
@@ -58,6 +59,7 @@ class ProductsExport implements FromCollection, WithMapping, WithHeadings
|
||||
$product->unit,
|
||||
// $product->current_stock,
|
||||
$qty,
|
||||
$product->est_shipping_days,
|
||||
$product->meta_title,
|
||||
$product->meta_description,
|
||||
];
|
||||
|
||||
@@ -56,6 +56,7 @@ class ProductsImport implements ToCollection, WithHeadingRow, WithValidation, To
|
||||
'unit' => $row['unit'],
|
||||
'meta_title' => $row['meta_title'],
|
||||
'meta_description' => $row['meta_description'],
|
||||
'est_shipping_days' => $row['est_shipping_days'],
|
||||
'colors' => json_encode(array()),
|
||||
'choice_options' => json_encode(array()),
|
||||
'variations' => json_encode(array()),
|
||||
|
||||
@@ -9,8 +9,6 @@ class Shop extends Model
|
||||
|
||||
protected $with = ['user'];
|
||||
|
||||
protected $fillable = ['name', 'address', 'user_id'];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
@@ -22,10 +20,4 @@ class Shop extends Model
|
||||
public function followers(){
|
||||
return $this->hasMany(FollowSeller::class);
|
||||
}
|
||||
|
||||
//URL AMIGABLES
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'slug';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,10 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
{
|
||||
use Notifiable, HasApiTokens, HasRoles;
|
||||
|
||||
|
||||
public function sendEmailVerificationNotification()
|
||||
{
|
||||
$this->notify(new EmailVerificationNotification());
|
||||
}
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
@@ -22,7 +25,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password', 'user_type', 'confirmation_code', 'address', 'city', 'postal_code', 'phone', 'country', 'provider_id', 'email_verified_at', 'verification_code'
|
||||
'name', 'email', 'password', 'address', 'city', 'postal_code', 'phone', 'country', 'provider_id', 'email_verified_at', 'verification_code'
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -148,10 +151,5 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
public function uploads(){
|
||||
return $this->hasMany(Upload::class);
|
||||
}
|
||||
|
||||
public function workshop()
|
||||
{
|
||||
return $this->hasOne(Workshop::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class Workshop extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name', 'address'];
|
||||
protected $fillable = ['name', 'address', 'delivery_pickup_latitude', 'delivery_pickup_longitude', 'user_id'];
|
||||
|
||||
public function user()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user