- 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.
21 lines
477 B
PHP
21 lines
477 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Announcement extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
public function partnerMedia(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(PartnerMedia::class, 'announcement_media');
|
|
}
|
|
}
|