ldc-legaulois/app/Models/BlockList.php

41 lines
931 B
PHP
Raw Permalink Normal View History

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