1
0
mirror of https://github.com/flarum/core.git synced 2025-02-25 03:33:42 +01:00

Not sure how these got in here...

This commit is contained in:
Toby Zerner 2015-07-01 22:47:57 +09:30
parent c1e7c00e2d
commit d99f77b08e
3 changed files with 0 additions and 56 deletions

View File

@ -1,27 +0,0 @@
<?php namespace Flarum\Core\Models;
abstract class EventPost extends Post implements MergeableInterface
{
use MergeableTrait;
/**
* Unserialize the content attribute.
*
* @param string $value
* @return string
*/
public function getContentAttribute($value)
{
return json_decode($value, true);
}
/**
* Serialize the content attribute.
*
* @param string $value
*/
public function setContentAttribute($value)
{
$this->attributes['content'] = json_encode($value);
}
}

View File

@ -1,6 +0,0 @@
<?php namespace Flarum\Core\Models;
interface MergeableInterface
{
public function saveAfter(Model $previous);
}

View File

@ -1,23 +0,0 @@
<?php namespace Flarum\Core\Models;
trait MergeableTrait
{
public function saveAfter(Model $previous)
{
if ($previous instanceof static) {
if ($merged = $this->mergeInto($previous)) {
$merged->save();
return $merged;
} else {
$previous->delete();
return $previous;
}
}
$this->save();
return $this;
}
abstract protected function mergeInto(Model $previous);
}