40 lines
931 B
PHP
40 lines
931 B
PHP
<?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 = [
|
|
'customer_id',
|
|
'blocked_id'
|
|
];
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
/**
|
|
* Get the associated customer who has blocked another one.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function customer(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(Customer::class);
|
|
}
|
|
|
|
/**
|
|
* Obtain the associated client that has been blocked by another one.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function blocked(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(Customer::class, 'blocked_id');
|
|
}
|
|
}
|