ldc-mesbr-app/app/Models/Campaign.php
Vincent BRIDIER 80dbb04671
PHPCS
2023-11-24 15:35:08 +01:00

45 lines
976 B
PHP

<?php
namespace App\Models;
use App\Enums\CampaignTypes;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Campaign extends Model
{
use HasFactory;
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'type' => CampaignTypes::class,
];
// * RELATIONS
/**
* Get the brand that owns the Campaign
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function brand(): BelongsTo
{
return $this->belongsTo(Brand::class);
}
/**
* Get coupons that owned by the Campaign
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function coupons(): BelongsToMany
{
return $this->belongsToMany(Coupon::class);
}
}