2020-12-01 17:02:10 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
2023-09-06 17:24:53 +02:00
|
|
|
/**
|
|
|
|
|
* @property integer $id Id.
|
|
|
|
|
* @property integer $customer_id Foreign key Customer.
|
|
|
|
|
* @property integer $brand_id Foreign key Brand.
|
|
|
|
|
* @property boolean $new_value
|
|
|
|
|
* @property-read \Illuminate\Support\Carbon $created_at Created date.
|
|
|
|
|
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
|
|
|
|
|
*
|
|
|
|
|
* @property-read \App\Models\Customer $customer Customer BelongsTo relation.
|
|
|
|
|
* @property-read \App\Models\Brand $brand Brand BelongsTo relation.
|
|
|
|
|
*/
|
2020-12-01 17:02:10 +01:00
|
|
|
class CustomerOptInHistory extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
2021-12-19 15:57:24 +01:00
|
|
|
/**
|
|
|
|
|
* The table associated with the model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2020-12-01 17:02:10 +01:00
|
|
|
protected $table = "customer_opt_in_history";
|
|
|
|
|
|
2023-09-06 17:24:53 +02:00
|
|
|
/**
|
|
|
|
|
* The attributes that should be cast to native types.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'new_value' => 'bool',
|
|
|
|
|
];
|
|
|
|
|
|
2021-12-19 15:57:24 +01:00
|
|
|
// * RELATIONS
|
|
|
|
|
|
2021-02-28 12:04:49 +01:00
|
|
|
/**
|
2023-09-06 17:24:53 +02:00
|
|
|
* Customer BelongsTo relation.
|
2021-02-28 12:04:49 +01:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
2023-09-06 17:24:53 +02:00
|
|
|
public function customer(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2021-02-28 12:04:49 +01:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Customer::class);
|
2020-12-01 17:02:10 +01:00
|
|
|
}
|
2021-08-11 17:25:24 +02:00
|
|
|
|
|
|
|
|
/**
|
2023-09-06 17:24:53 +02:00
|
|
|
* Brand BelongsTo relation.
|
2021-08-11 17:25:24 +02:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
2023-09-06 17:24:53 +02:00
|
|
|
public function brand(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2021-08-11 17:25:24 +02:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Brand::class);
|
|
|
|
|
}
|
2020-12-01 17:02:10 +01:00
|
|
|
}
|