created_by corrected

This commit is contained in:
Benjamin Takats
2022-12-15 21:51:15 +01:00
parent ce0c12ac9e
commit cf31b4d5ea
16 changed files with 136 additions and 17 deletions

View File

@@ -25,6 +25,13 @@ class Podcast extends Model
'data' => 'array',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(User::class, 'created_by');