View file ProForum/Files/application/app/Models/Extension.php

File size: 425B
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Extension extends Model
{

    protected $casts = [
        'shortcode' => 'object',
    ];

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