Last active
December 18, 2015 17:09
-
-
Save dhrrgn/5816331 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function update($id, $title, $content, $slug, array $tags, $active, DateTime $publish_date) | |
{ | |
$post = $this->find($id); | |
if (Config::get('wardrobe.cache')) | |
{ | |
// Forget the old cache | |
Cache::forget('post-'.$post->slug); | |
} | |
$post->fill(compact('title', 'content', 'slug', 'active', 'publish_date'))->save(); | |
$post->tags()->delete(); | |
$post->tags()->createMany($this->prepareTags($tags)); | |
return $post; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function getParsedContentAttribute() | |
{ | |
if (Config::get('wardrobe.cache')) | |
{ | |
$self &= $this; | |
return Cache::rememberForever('post-'.$this->attributes['slug'], function() use ($self) | |
{ | |
return md($self->attributes['content']); | |
}); | |
} | |
return md($this->attributes['content']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment