ItemPost
and ServicePost
models are inheriting Post
model:
namespace App\Models;
class Post
{
}
class ItemPost extends Post
{
}
class ServicePost extends Post
{
}
Then which one of the followings is a good or bad practice? And why?
namespace App\Http\Controllers;
use App\Models\ItemPost as Post;
class ItemPostController
{
public function __construct(Post $post)
{
}
}
OR
namespace App\Http\Controllers;
use App\Models\ServicePost;
class ServicePostController
{
public function __construct(ServicePost $post)
{
}
}