fixes on mail templates, change order edit layout, add DeliveryTypes, DeliveryTypeCalculations & DeliveryPackages
This commit is contained in:
16
app/Models/Shop/DeliveryPackage.php
Normal file
16
app/Models/Shop/DeliveryPackage.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DeliveryPackage extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_delivery_packages';
|
||||
|
||||
public function scopeByWeight($query, $weight)
|
||||
{
|
||||
return $query->orderBy('weight')->where($this->table . '.weight', '>=', $weight);
|
||||
}
|
||||
}
|
||||
11
app/Models/Shop/DeliveryType.php
Normal file
11
app/Models/Shop/DeliveryType.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DeliveryType extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_delivery_types';
|
||||
}
|
||||
26
app/Models/Shop/DeliveryTypeCalculation.php
Normal file
26
app/Models/Shop/DeliveryTypeCalculation.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DeliveryTypeCalculation extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_delivery_type_calculations';
|
||||
|
||||
public function DeliveryType()
|
||||
{
|
||||
return $this->belongsTo(DeliveryType::class);
|
||||
}
|
||||
|
||||
public function scopeByDeliveryType($query, $id)
|
||||
{
|
||||
return $query->where($this->table . '.type_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByWeight($query, $weight)
|
||||
{
|
||||
return $query->orderBy('weight')->where($this->table . '.weight', '>=', $weight);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,11 @@ class Order extends Model
|
||||
return $this->belongsTo(CustomerAddress::class, 'customer_address_id');
|
||||
}
|
||||
|
||||
public function delivery_address()
|
||||
{
|
||||
return $this->belongsTo(CustomerAddress::class, 'customer_delivery_id');
|
||||
}
|
||||
|
||||
public function delivery()
|
||||
{
|
||||
return $this->belongsTo(Delivery::class);
|
||||
|
||||
Reference in New Issue
Block a user