Updated Videotex frame to use Parser

This commit is contained in:
Deon George
2018-12-29 23:24:41 +11:00
parent 35b5bc2263
commit 390f52a460
12 changed files with 200 additions and 140 deletions

View File

@@ -7,6 +7,8 @@ use Illuminate\Database\Eloquent\Model;
class Frame extends Model
{
public $cache_content = '';
public function cug()
{
return $this->belongsTo(CUG::class);
@@ -32,9 +34,14 @@ class Frame extends Model
*/
public function getContentAttribute()
{
return is_resource($this->attributes['content'])
? stream_get_contents($this->attributes['content'])
: $this->attributes['content'];
// For stream resources, we need to cache this result.
if (! $this->cache_content) {
$this->cache_content = is_resource($this->attributes['content'])
? stream_get_contents($this->attributes['content'])
: $this->attributes['content'];
}
return $this->cache_content;
}
/**