Dependency injection vs just using facades?
Hi guys, I see a lot of people recommending this:
use App\User;
class BlahController extends Controller {
protected $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function show($id)
{
return $this->user->find($id);
}
}
Over this:
use App\User;
class BlahController extends Controller {
public function show($id)
{
return User::find($id);
}
}