'integer', 'language_codes' => 'array', ]; protected static function booted() { static::creating(function ($model) { if (! $model->created_by) { $model->created_by = auth()->id(); } }); } public function createdBy(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } public function libraryItems(): BelongsToMany { return $this->belongsToMany(LibraryItem::class); } public function parent(): BelongsTo { return $this->belongsTo(__CLASS__, 'parent_id'); } }