mirror of
https://github.com/flarum/core.git
synced 2025-10-18 10:16:09 +02:00
Added post extender with type method, deprecated ConfigurePostTypes (#2101)
This commit is contained in:
committed by
GitHub
parent
5842dd1200
commit
cee87848fe
@@ -218,7 +218,7 @@ class Post extends AbstractModel
|
||||
* @param string $model The class name of the model for that type.
|
||||
* @return void
|
||||
*/
|
||||
public static function setModel($type, $model)
|
||||
public static function setModel(string $type, string $model)
|
||||
{
|
||||
static::$models[$type] = $model;
|
||||
}
|
||||
|
@@ -21,19 +21,20 @@ class PostServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
CommentPost::setFormatter($this->app->make('flarum.formatter'));
|
||||
|
||||
$this->registerPostTypes();
|
||||
$this->setPostTypes();
|
||||
|
||||
$events = $this->app->make('events');
|
||||
$events->subscribe(PostPolicy::class);
|
||||
}
|
||||
|
||||
public function registerPostTypes()
|
||||
protected function setPostTypes()
|
||||
{
|
||||
$models = [
|
||||
CommentPost::class,
|
||||
DiscussionRenamedPost::class
|
||||
];
|
||||
|
||||
// Deprecated in beta 15, remove in beta 16.
|
||||
$this->app->make('events')->dispatch(
|
||||
new ConfigurePostTypes($models)
|
||||
);
|
||||
|
Reference in New Issue
Block a user