2024-07-11 15:46:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2026-09-25 16:25:31 +02:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2024-07-11 15:46:43 +02:00
|
|
|
|
|
|
|
|
class BlockList extends Model
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
|
*
|
2026-09-25 16:25:31 +02:00
|
|
|
* @var array<int, string>
|
2024-07-11 15:46:43 +02:00
|
|
|
*/
|
|
|
|
|
protected $fillable = [
|
2024-07-30 16:05:27 +02:00
|
|
|
'customer_id',
|
2026-09-25 16:25:31 +02:00
|
|
|
'blocked_id',
|
2024-07-11 15:46:43 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
|
|
2024-07-12 16:33:26 +02:00
|
|
|
/**
|
2024-09-26 17:39:57 +02:00
|
|
|
* Get the associated customer who has blocked another one.
|
2024-07-12 16:33:26 +02:00
|
|
|
*/
|
2026-09-25 16:25:31 +02:00
|
|
|
public function customer(): BelongsTo
|
2024-07-11 15:46:43 +02:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Customer::class);
|
|
|
|
|
}
|
2024-07-12 16:33:26 +02:00
|
|
|
|
|
|
|
|
/**
|
2024-09-26 17:39:57 +02:00
|
|
|
* Obtain the associated client that has been blocked by another one.
|
2024-07-12 16:33:26 +02:00
|
|
|
*/
|
2026-09-25 16:25:31 +02:00
|
|
|
public function blocked(): BelongsTo
|
2024-07-11 15:46:43 +02:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(Customer::class, 'blocked_id');
|
|
|
|
|
}
|
|
|
|
|
}
|