1
0
mirror of https://github.com/flarum/core.git synced 2025-10-11 23:14:29 +02:00

Implement notifications

This commit is contained in:
Toby Zerner
2015-03-24 15:07:38 +10:30
parent 1d1025dcd2
commit 4a1550215c
34 changed files with 808 additions and 38 deletions

View File

@@ -15,4 +15,9 @@ class Actor
{
$this->user = $user;
}
public function isAuthenticated()
{
return (bool) $this->user;
}
}

View File

@@ -0,0 +1,43 @@
<?php namespace Flarum\Core\Support;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class MappedMorphTo extends MorphTo {
/**
*
* @var string
*/
protected $types;
/**
* Create a new morph to relationship instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $foreignKey
* @param string $otherKey
* @param string $type
* @param string $relation
* @return void
*/
public function __construct(Builder $query, Model $parent, $foreignKey, $otherKey, $type, $relation, $types)
{
$this->types = $types;
parent::__construct($query, $parent, $foreignKey, $otherKey, $type, $relation);
}
/**
* Create a new model instance by type.
*
* @param string $type
* @return \Illuminate\Database\Eloquent\Model
*/
public function createModelByType($type)
{
return new $this->types[$type];
}
}