'object', ]; protected $hidden = ['script','shortcode']; public function scopeGenerateScript() { $script = $this->script; foreach ($this->shortcode as $key => $item) { $script = str_replace('{{' . $key . '}}', $item->value, $script); } return $script; } }