1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 10:16:09 +02:00

Clean up Eloquent definitions

This commit is contained in:
Toby Zerner
2018-07-21 17:06:42 +09:30
parent 87bba2186e
commit 0fb81958cb
12 changed files with 43 additions and 66 deletions

View File

@@ -43,18 +43,17 @@ class Post extends AbstractModel
{
use EventGeneratorTrait;
/**
* {@inheritdoc}
*/
protected $table = 'posts';
/**
* {@inheritdoc}
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['created_at', 'edited_at', 'hidden_at'];
/**
* Casts properties to a specific type.
* The attributes that should be cast to native types.
*
* @var array
*/
@@ -150,7 +149,7 @@ class Post extends AbstractModel
*/
public function discussion()
{
return $this->belongsTo('Flarum\Discussion\Discussion', 'discussion_id');
return $this->belongsTo(Discussion::class);
}
/**
@@ -160,7 +159,7 @@ class Post extends AbstractModel
*/
public function user()
{
return $this->belongsTo('Flarum\User\User', 'user_id');
return $this->belongsTo(User::class);
}
/**
@@ -170,7 +169,7 @@ class Post extends AbstractModel
*/
public function editUser()
{
return $this->belongsTo('Flarum\User\User', 'edited_user_id');
return $this->belongsTo(User::class, 'edited_user_id');
}
/**
@@ -180,7 +179,7 @@ class Post extends AbstractModel
*/
public function hideUser()
{
return $this->belongsTo('Flarum\User\User', 'hidden_user_id');
return $this->belongsTo(User::class, 'hidden_user_id');
}
/**