forked from eatvio/eatvio-infra
refactoring: folowing phpinsights recomendations
This commit is contained in:
@@ -21,6 +21,20 @@ class Plan extends Model implements Viewable
|
||||
use InteractsWithViews;
|
||||
use PresentableTrait;
|
||||
|
||||
protected $withCount = [
|
||||
'likes',
|
||||
'comments',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'type' => 'array',
|
||||
'packet1_options' => 'array',
|
||||
'packet2_options' => 'array',
|
||||
'packet3_options' => 'array',
|
||||
];
|
||||
|
||||
protected $presenter = PlanPresenter::class;
|
||||
|
||||
public function getSlugOptions(): SlugOptions
|
||||
{
|
||||
return SlugOptions::create()
|
||||
@@ -42,20 +56,6 @@ class Plan extends Model implements Viewable
|
||||
return 'slug';
|
||||
}
|
||||
|
||||
protected $withCount = [
|
||||
'likes',
|
||||
'comments',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'type' => 'array',
|
||||
'packet1_options' => 'array',
|
||||
'packet2_options' => 'array',
|
||||
'packet3_options' => 'array',
|
||||
];
|
||||
|
||||
protected $presenter = PlanPresenter::class;
|
||||
|
||||
public function author()
|
||||
{
|
||||
return $this->belongsToMany(User::class, 'plan_author', 'plan_id', 'user_id');
|
||||
|
||||
Reference in New Issue
Block a user