mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 02:42:44 +08:00
Use ::class, update some typehints
This commit is contained in:
parent
3480a65989
commit
1c87c33d4d
|
@ -23,7 +23,6 @@ use Flarum\Foundation\EventGeneratorTrait;
|
|||
use Flarum\Post\Event\Deleted as PostDeleted;
|
||||
use Flarum\Post\MergeableInterface;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\User\Guest;
|
||||
use Flarum\User\User;
|
||||
use Flarum\Util\Str;
|
||||
|
||||
|
@ -101,7 +100,7 @@ class Discussion extends AbstractModel
|
|||
{
|
||||
parent::boot();
|
||||
|
||||
static::deleted(function ($discussion) {
|
||||
static::deleted(function (Discussion $discussion) {
|
||||
$discussion->raise(new Deleted($discussion));
|
||||
|
||||
// Delete all of the posts in the discussion. Before we delete them
|
||||
|
@ -234,6 +233,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function refreshLastPost()
|
||||
{
|
||||
/** @var Post $lastPost */
|
||||
if ($lastPost = $this->comments()->latest('time')->first()) {
|
||||
$this->setLastPost($lastPost);
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function startPost()
|
||||
{
|
||||
return $this->belongsTo('Flarum\Post\Post', 'start_post_id');
|
||||
return $this->belongsTo(Post::class, 'start_post_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -366,7 +366,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function startUser()
|
||||
{
|
||||
return $this->belongsTo('Flarum\User\User', 'start_user_id');
|
||||
return $this->belongsTo(User::class, 'start_user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -376,7 +376,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function lastPost()
|
||||
{
|
||||
return $this->belongsTo('Flarum\Post\Post', 'last_post_id');
|
||||
return $this->belongsTo(Post::class, 'last_post_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -386,7 +386,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function lastUser()
|
||||
{
|
||||
return $this->belongsTo('Flarum\User\User', 'last_user_id');
|
||||
return $this->belongsTo(User::class, 'last_user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -396,7 +396,7 @@ class Discussion extends AbstractModel
|
|||
*/
|
||||
public function readers()
|
||||
{
|
||||
return $this->belongsToMany('Flarum\User\User', 'users_discussions');
|
||||
return $this->belongsToMany(User::class, 'users_discussions');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -415,7 +415,7 @@ class Discussion extends AbstractModel
|
|||
{
|
||||
$user = $user ?: static::$stateUser;
|
||||
|
||||
return $this->hasOne('Flarum\Discussion\UserState')->where('user_id', $user ? $user->id : null);
|
||||
return $this->hasOne(UserState::class)->where('user_id', $user ? $user->id : null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user