43 lines
877 B
PHP
43 lines
877 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Juil;
|
||
|
|
|
||
|
|
use App\Models\User;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
class PmisNotice extends Model
|
||
|
|
{
|
||
|
|
use SoftDeletes;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'tenant_id',
|
||
|
|
'title',
|
||
|
|
'content',
|
||
|
|
'author_id',
|
||
|
|
'views',
|
||
|
|
'options',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'options' => 'array',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function scopeTenant($query, $tenantId)
|
||
|
|
{
|
||
|
|
return $query->where('tenant_id', $tenantId);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function author(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class, 'author_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function attachments(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(PmisNoticeAttachment::class, 'notice_id');
|
||
|
|
}
|
||
|
|
}
|