fixes on mail templates, change order edit layout, add DeliveryTypes, DeliveryTypeCalculations & DeliveryPackages

This commit is contained in:
Ludovic CANDELLIER
2023-05-24 23:30:29 +02:00
parent c677dbd5fa
commit 9f9b7173d7
13 changed files with 220 additions and 43 deletions

View 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);
}
}

View 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';
}

View 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);
}
}

View File

@@ -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);