Apply fixes from StyleCI (#1793)

[ci skip] [skip ci]
This commit is contained in:
Franz Liedke 2019-06-12 23:50:21 +02:00 committed by GitHub
parent a5b70d5175
commit ae409751c1
6 changed files with 12 additions and 12 deletions

View File

@ -55,13 +55,13 @@ abstract class AbstractModel extends Eloquent
{
parent::boot();
static::saved(function (AbstractModel $model) {
static::saved(function (self $model) {
foreach ($model->releaseAfterSaveCallbacks() as $callback) {
$callback($model);
}
});
static::deleted(function (AbstractModel $model) {
static::deleted(function (self $model) {
foreach ($model->releaseAfterDeleteCallbacks() as $callback) {
$callback($model);
}

View File

@ -98,7 +98,7 @@ class Discussion extends AbstractModel
{
parent::boot();
static::deleting(function (Discussion $discussion) {
static::deleting(function (self $discussion) {
Notification::whereSubjectModel(Post::class)
->whereIn('subject_id', function ($query) use ($discussion) {
$query->select('id')->from('posts')->where('discussion_id', $discussion->id);
@ -106,13 +106,13 @@ class Discussion extends AbstractModel
->delete();
});
static::deleted(function (Discussion $discussion) {
static::deleted(function (self $discussion) {
$discussion->raise(new Deleted($discussion));
Notification::whereSubject($discussion)->delete();
});
static::saving(function (Discussion $discussion) {
static::saving(function (self $discussion) {
$event = new GetModelIsPrivate($discussion);
$discussion->is_private = static::$dispatcher->until($event) === true;

View File

@ -712,7 +712,7 @@ class Application extends Container implements ApplicationContract
public function registerCoreContainerAliases()
{
$aliases = [
'app' => [\Flarum\Foundation\Application::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],
'cache' => [\Illuminate\Cache\CacheManager::class, \Illuminate\Contracts\Cache\Factory::class],
'cache.store' => [\Illuminate\Cache\Repository::class, \Illuminate\Contracts\Cache\Repository::class],

View File

@ -62,7 +62,7 @@ class Group extends AbstractModel
{
parent::boot();
static::deleted(function (Group $group) {
static::deleted(function (self $group) {
$group->raise(new Deleted($group));
});
}

View File

@ -92,19 +92,19 @@ class Post extends AbstractModel
// When a post is created, set its type according to the value of the
// subclass. Also give it an auto-incrementing number within the
// discussion.
static::creating(function (Post $post) {
static::creating(function (self $post) {
$post->type = $post::$type;
$post->number = ++$post->discussion->post_number_index;
$post->discussion->save();
});
static::saving(function (Post $post) {
static::saving(function (self $post) {
$event = new GetModelIsPrivate($post);
$post->is_private = static::$dispatcher->until($event) === true;
});
static::deleted(function (Post $post) {
static::deleted(function (self $post) {
$post->raise(new Deleted($post));
Notification::whereSubject($post)->delete();

View File

@ -115,13 +115,13 @@ class User extends AbstractModel
parent::boot();
// Don't allow the root admin to be deleted.
static::deleting(function (User $user) {
static::deleting(function (self $user) {
if ($user->id == 1) {
throw new DomainException('Cannot delete the root admin');
}
});
static::deleted(function (User $user) {
static::deleted(function (self $user) {
$user->raise(new Deleted($user));
Notification::whereSubject($user)->delete();