ldc-boutique-cnc/app/Models/Promotion.php

42 lines
860 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Promotion extends Model
{
use HasFactory;
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'date_start' => 'datetime',
'date_end' => 'datetime',
];
2022-09-03 16:56:16 +02:00
/**
* BelongsToMany products relation
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function products()
{
return $this->belongsToMany(Product::class);
}
2022-09-03 16:56:16 +02:00
/**
* BelongsTo discountType relation
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function discountType()
{
return $this->belongsTo(DiscountType::class, 'discount_type_id');
}
}