feat: Reorganize database migrations for module snapshots, VMware, and OS groups, and implement customer order creation email notifications.
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class OrderItem extends Model
|
||||
{
|
||||
@@ -31,6 +32,15 @@ class OrderItem extends Model
|
||||
return $this->belongsTo(Product::class, 'product_id');
|
||||
}
|
||||
|
||||
public function getProductAttribute(): ?Product
|
||||
{
|
||||
if ($this->relationLoaded('product')) {
|
||||
return $this->getRelation('product');
|
||||
}
|
||||
|
||||
return $this->product()->first();
|
||||
}
|
||||
|
||||
public function pricing()
|
||||
{
|
||||
return $this->belongsTo(ProductPricings::class, 'product_pricing_id');
|
||||
|
||||
Reference in New Issue
Block a user