You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
763 B
38 lines
763 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class PublicSourceChannel extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const STATUS_ENABLED = 'enabled';
|
|
|
|
public const STATUS_DISABLED = 'disabled';
|
|
|
|
public const STATUSES = [
|
|
self::STATUS_ENABLED,
|
|
self::STATUS_DISABLED,
|
|
];
|
|
|
|
protected $fillable = [
|
|
'source_code',
|
|
'source_name',
|
|
'status',
|
|
];
|
|
|
|
public function users(): HasMany
|
|
{
|
|
return $this->hasMany(User::class, 'public_source_channel_id');
|
|
}
|
|
|
|
public function isEnabled(): bool
|
|
{
|
|
return $this->status === self::STATUS_ENABLED;
|
|
}
|
|
}
|