refactoring: folowing phpinsights recomendations

This commit is contained in:
Anatoliy Poloz
2023-12-28 17:07:09 +03:00
parent 0efb8536dd
commit 9b2d703374
23 changed files with 244 additions and 170 deletions

View File

@@ -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');