You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Final fix delete storage link to fix news_images and logs 🆙
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Articles;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class WebsiteArticleReaction extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $hidden = [
|
||||
'user_id',
|
||||
'article_id',
|
||||
];
|
||||
|
||||
public static function getReaction(int $articleId, int $userId, string $reaction): ?self
|
||||
{
|
||||
return self::where('user_id', $userId)
|
||||
->where('article_id', $articleId)
|
||||
->where('reaction', $reaction)
|
||||
->first();
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model): void {
|
||||
$model->user_id = auth()->id();
|
||||
});
|
||||
}
|
||||
|
||||
public function article(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(WebsiteArticle::class, 'article_id');
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user