update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
72
dev/app-bak/Models/ShippingCountry.php
Normal file
72
dev/app-bak/Models/ShippingCountry.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\ShippingCountry as ModelsShippingCountry;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\ShippingCountry
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $shipping_id
|
||||
* @property int|null $country_id
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\Models\Country|null $country
|
||||
* @property-read \App\Models\Shipping $shipping
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereCountryId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereShippingId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\ShippingCountry whereUpdatedAt($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\ShoppingOrder[] $shopping_orders
|
||||
* @property-read int|null $shopping_orders_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ShippingCountry extends Model
|
||||
{
|
||||
protected $table = 'shipping_countries';
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'shipping_id', 'country_id'
|
||||
];
|
||||
|
||||
public function shipping()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shipping', 'shipping_id');
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Country', 'country_id');
|
||||
}
|
||||
|
||||
public function shopping_orders()
|
||||
{
|
||||
return $this->hasMany('App\Models\ShoppingOrder', 'country_id');
|
||||
}
|
||||
|
||||
public function hasShoppingOrders()
|
||||
{
|
||||
return $this->shopping_orders()->exists();
|
||||
}
|
||||
|
||||
|
||||
public static function getActiveShippingCountries(){
|
||||
$ret = [];
|
||||
$ShippingCountries = ShippingCountry::all();
|
||||
foreach($ShippingCountries as $ShippingCountry){
|
||||
if($ShippingCountry->shipping->active){
|
||||
$ret[$ShippingCountry->country_id] = $ShippingCountry->country->getLocated();
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue