2020-12-01 17:02:10 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2023-06-26 15:10:28 +02:00
|
|
|
use Illuminate\Support\Str;
|
2020-12-01 17:02:10 +01:00
|
|
|
|
2020-12-02 10:08:27 +01:00
|
|
|
class SingleOptin extends Model
|
2020-12-01 17:02:10 +01:00
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
2023-06-26 15:10:28 +02:00
|
|
|
/**
|
|
|
|
|
* The primary key for the model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $primaryKey = 'hashcode';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The "type" of the primary key ID.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $keyType = 'uuid';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates if the IDs are auto-incrementing.
|
|
|
|
|
*
|
|
|
|
|
* @var boolean
|
|
|
|
|
*/
|
|
|
|
|
public $incrementing = false;
|
|
|
|
|
|
2021-12-19 15:57:24 +01:00
|
|
|
/**
|
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
|
*
|
|
|
|
|
* @var string[]
|
|
|
|
|
*/
|
2021-03-14 10:45:42 +01:00
|
|
|
protected $fillable = [
|
|
|
|
|
'email'
|
|
|
|
|
];
|
|
|
|
|
|
2023-06-26 15:10:28 +02:00
|
|
|
/**
|
|
|
|
|
* Perform any actions required after the model boots.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
protected static function booted()
|
|
|
|
|
{
|
|
|
|
|
static::creating(function (self $model) {
|
|
|
|
|
$model->hashcode = Str::uuid();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-19 15:57:24 +01:00
|
|
|
// * RELATIONS
|
|
|
|
|
|
2021-02-28 12:04:49 +01:00
|
|
|
/**
|
|
|
|
|
* Brand BelongsTo relation
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
|
|
|
|
public function brand()
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Brand::class);
|
2020-12-01 17:02:10 +01:00
|
|
|
}
|
|
|
|
|
}
|