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

Split up old CoreServiceProvider

This commit is contained in:
Franz Liedke
2017-06-24 14:51:42 +02:00
parent e6e4531771
commit 66f35d2530
9 changed files with 187 additions and 48 deletions

View File

@@ -0,0 +1,47 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Post;
use Flarum\Event\ConfigurePostTypes;
use Flarum\Foundation\AbstractServiceProvider;
class PostServiceProvider extends AbstractServiceProvider
{
/**
* {@inheritdoc}
*/
public function boot()
{
CommentPost::setFormatter($this->app->make('flarum.formatter'));
$this->registerPostTypes();
$events = $this->app->make('events');
$events->subscribe('Flarum\Post\PostPolicy');
}
public function registerPostTypes()
{
$models = [
'Flarum\Post\CommentPost',
'Flarum\Post\DiscussionRenamedPost'
];
$this->app->make('events')->fire(
new ConfigurePostTypes($models)
);
foreach ($models as $model) {
Post::setModel($model::$type, $model);
}
}
}