Imagine situation that in laravels constructor(PostController) I need to Inject 3 models: User, Post and Comment.
I have two scenarios:
1) Inject these 3 Models all in controllers constructor and then I use this controllers variables in concrete functions like this: $this->post
2) Inject these models in concrete controller's functions whenever, wherever needed (For example index(Post $post));
which of these two is better practice? In first scenario, in index function I only use $this->post variable, but I also create $this->comment and $this->user because I need them in other functions? but I don't need them in index, so I inject and create them for nothing whenever I call index by addressing index specific route. Isn't that bad? so which of these is better?