12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
105
app/Models/PressRelease.php
Normal file
105
app/Models/PressRelease.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Concerns\HasUniqueSlug;
|
||||
use App\Scopes\PortalScope;
|
||||
use Database\Factories\PressReleaseFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class PressRelease extends Model
|
||||
{
|
||||
/** @use HasFactory<PressReleaseFactory> */
|
||||
use HasFactory, HasUniqueSlug, SoftDeletes;
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
protected function slugScopeAttributes(): array
|
||||
{
|
||||
return ['portal', 'language'];
|
||||
}
|
||||
|
||||
protected function slugFallback(): string
|
||||
{
|
||||
return 'pressemitteilung';
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::addGlobalScope(new PortalScope);
|
||||
}
|
||||
|
||||
protected $fillable = [
|
||||
'uuid',
|
||||
'portal',
|
||||
'user_id',
|
||||
'company_id',
|
||||
'category_id',
|
||||
'language',
|
||||
'title',
|
||||
'slug',
|
||||
'text',
|
||||
'backlink_url',
|
||||
'keywords',
|
||||
'status',
|
||||
'hits',
|
||||
'teaser_begin',
|
||||
'teaser_end',
|
||||
'no_export',
|
||||
'published_at',
|
||||
'legacy_portal',
|
||||
'legacy_id',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'portal' => Portal::class,
|
||||
'status' => PressReleaseStatus::class,
|
||||
'hits' => 'integer',
|
||||
'teaser_begin' => 'integer',
|
||||
'teaser_end' => 'integer',
|
||||
'no_export' => 'boolean',
|
||||
'published_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function company(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Company::class);
|
||||
}
|
||||
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function images(): HasMany
|
||||
{
|
||||
return $this->hasMany(PressReleaseImage::class);
|
||||
}
|
||||
|
||||
public function contacts(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Contact::class, 'press_release_contact');
|
||||
}
|
||||
|
||||
public function statusLogs(): HasMany
|
||||
{
|
||||
return $this->hasMany(PressReleaseStatusLog::class)->orderByDesc('created_at');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue