- Introduced a many-to-many relationship in PartnerMedia for announcements. - Added a has-many relationship in User for news authored by the user. - Implemented an active scope in User for filtering active users.
26 lines
560 B
PHP
26 lines
560 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class AnnouncementUser extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
public function announcement(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Announcement::class);
|
|
}
|
|
|
|
public function partnerMedia(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PartnerMedia::class);
|
|
}
|
|
}
|