40 lines
751 B
PHP
40 lines
751 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Followee extends Model
|
|
{
|
|
protected $fillable = [
|
|
'user_id',
|
|
'followee_id',
|
|
'verified',
|
|
];
|
|
|
|
protected $casts = [
|
|
'verified' => 'boolean',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function followee(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'followee_id');
|
|
}
|
|
|
|
public function scopeVerified($query)
|
|
{
|
|
return $query->where('verified', true);
|
|
}
|
|
|
|
public function scopePending($query)
|
|
{
|
|
return $query->where('verified', false);
|
|
}
|
|
}
|