*/ protected $dispatchesEvents = [ 'created' => VideoScriptCreated::class, 'deleted' => VideoScriptDeleted::class, 'forceDeleting' => VideoScriptForceDeleting::class, 'restored' => VideoScriptRestored::class, 'updated' => VideoScriptUpdated::class, ]; /** * The attributes that are mass assignable. * * @var list */ protected $fillable = [ VideoScript::ATTRIBUTE_PATH, VideoScript::ATTRIBUTE_VIDEO, ]; /** * The accessors to append to the model's array form. * * @var list */ protected $appends = [ VideoScript::ATTRIBUTE_LINK, ]; protected function getLinkAttribute(): ?string { // Necessary for 'make' factories. if ($this->hasAttribute(VideoScript::ATTRIBUTE_ID)) { return route('videoscript.show', $this); } return null; } public function getName(): string { return $this->path; } public function getSubtitle(): string { return $this->video->getName(); } /** * @return BelongsTo */ public function video(): BelongsTo { return $this->belongsTo(Video::class, VideoScript::ATTRIBUTE_VIDEO); } /** * Get the schema for the model. */ public function schema(): ScriptSchema { return new ScriptSchema(); } }