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

@@ -16,23 +16,28 @@ class BitcoinEvent extends Model implements HasMedia
/**
* The attributes that aren't mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'id' => 'integer',
'id' => 'integer',
'venue_id' => 'integer',
'from' => 'datetime',
'to' => 'datetime',
'from' => 'datetime',
'to' => 'datetime',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void
{
$this

View File

@@ -37,6 +37,13 @@ class BookCase extends Model implements HasMedia
'deactivated' => 'boolean',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void
{
$this

View File

@@ -29,6 +29,13 @@ class City extends Model
'country_id' => 'integer',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
/**
* Get the options for generating the slug.
*/

View File

@@ -33,6 +33,13 @@ class Course extends Model implements HasMedia
'lecturer_id' => 'integer',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void
{
$this

View File

@@ -29,6 +29,13 @@ class CourseEvent extends Model
'to' => 'datetime',
];
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');

View File

@@ -28,6 +28,13 @@ class Episode 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');

View File

@@ -32,6 +32,13 @@ class Lecturer extends Model implements HasMedia
'active' => 'boolean',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void
{
$this

View File

@@ -26,6 +26,13 @@ class Library extends Model
'language_codes' => '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');

View File

@@ -37,6 +37,13 @@ class LibraryItem extends Model implements HasMedia, Sortable
'library_id' => 'integer',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void
{
$this

View File

@@ -30,6 +30,13 @@ class Meetup extends Model implements HasMedia
'city_id' => 'integer',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void
{
$this

View File

@@ -27,6 +27,13 @@ class MeetupEvent extends Model
'start' => 'datetime',
];
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');

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');

View File

@@ -34,6 +34,13 @@ class Venue extends Model implements HasMedia
'city_id' => 'integer',
];
protected static function booted()
{
static::creating(function ($model) {
$model->created_by = auth()->id();
});
}
public function registerMediaConversions(Media $media = null): void
{
$this