🆙 Final fix delete storage link to fix news_images and logs 🆙

This commit is contained in:
Remco
2026-01-07 20:29:24 +01:00
parent 65ea6c167f
commit acf2d7e661
447 changed files with 208 additions and 66965 deletions
@@ -1,65 +0,0 @@
<?php
namespace App\Models\Articles;
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;
use Illuminate\Support\Facades\Auth;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
class WebsiteArticle extends Model
{
use HasSlug, SoftDeletes;
protected $guarded = ['id'];
public function getSlugOptions(): SlugOptions
{
return SlugOptions::create()
->generateSlugsFrom('title')
->saveSlugsTo('slug')
->usingSeparator('-')->allowDuplicateSlugs();
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function reactions(): HasMany
{
return $this->hasMany(WebsiteArticleReaction::class, 'article_id')
->whereActive(true);
}
public function comments(): HasMany
{
return $this->hasMany(WebsiteArticleComment::class, 'article_id');
}
public function userHasReachedArticleCommentLimit(): bool
{
return $this->comments()->where('user_id', '=', Auth::id())->count() >= (int) setting('max_comment_per_article');
}
#[\Override]
protected static function boot()
{
parent::boot();
static::saving(function ($model): void {
if (empty($model->image)) {
$model->image = '';
}
});
}
public function tags()
{
return $this->morphToMany(Tag::class, 'taggable');
}
}