'jasonwilliams\feed\Models\Links', 'tags' => 'jasonwilliams\feed\Models\Tags' ]; public $belongsTo = [ 'channel' => ['jasonwilliams\feed\Models\Channels', 'key' => 'channel_id'] ]; public function afterFetch() { // Add clickable hashtags to the title field $this->title = preg_replace('/#(\w*[a-zA-Z]+\w*)/', '#$1', $this->title); // Add a friendlytime field $this->friendlytime = date('M j, Y', $this->timestamp); // Expand extras to an object if ($this->extra) $this->extra = json_decode($this->extra); // Add twitter user links if ($this->channel_id == 2) $this->title = preg_replace('/@([a-zA-Z0-9_]+)/', '@$1', $this->title); // Add instagram user links if ($this->channel_id == 3) $this->title = preg_replace('/@([a-zA-Z0-9_]+)/', '@$1', $this->title); // Add foursquare user Links if ($this->channel_id == 6 && !empty($this->body)) $this->body = preg_replace('/@([a-zA-Z0-9_]+)/', '@$1', $this->body); // Find and replace links foreach($this->links as $link) { $this->title = str_replace($link->addr, "addr."\">".$link->display."", $this->title); } } }