mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-14 06:36:46 +00:00
🚀 feat(news): add news management with upload functionality and category selection in the association module
This commit is contained in:
36
app/Models/Notification.php
Normal file
36
app/Models/Notification.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\NewsCategory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
|
||||
class Notification extends Model implements HasMedia
|
||||
{
|
||||
use InteractsWithMedia;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'category' => NewsCategory::class,
|
||||
];
|
||||
}
|
||||
|
||||
public function registerMediaCollections(): void
|
||||
{
|
||||
$this
|
||||
->addMediaCollection('pdf')
|
||||
->acceptsMimeTypes(['application/pdf'])
|
||||
->singleFile();
|
||||
}
|
||||
|
||||
public function einundzwanzigPleb(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EinundzwanzigPleb::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user