You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 More fixes 🆙
This commit is contained in:
@@ -3,14 +3,11 @@
|
||||
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;
|
||||
@@ -34,15 +31,22 @@ class WebsiteArticleReaction extends Model
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model): void {
|
||||
$model->user_id = auth()->id();
|
||||
/** @var WebsiteArticleReaction $model */
|
||||
$model->user_id = (int) auth()->id();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<WebsiteArticle, $this>
|
||||
*/
|
||||
public function article(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(WebsiteArticle::class, 'article_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<User, $this>
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
|
||||
Reference in New Issue
Block a user