This is a two-part question but I believe they are closely related.
I am learning calling classes with Laravel, and trying to clarify when a "bound" (if I am saying this correctly) class may be called. This is Laravel 4.2.)
Well into the application, in file app/lib/Repositories/Node/EloquentNodeRepository.php
, I am able to call this:
Db::enableQueryLog();
and it works great.
However, trying that same command in app/client/controllers/PageController.php
(the parent method, specified in routes.php
), it cannot find Db
but instead I use this (and it works):
\Illuminate\Support\Facades\Db::enableQueryLog();
That is not the primary issue, though the obvious question is why I cannot just use Db
yet, or should I even expect this.
My question, however, is: "When is the earliest point in my application where I may use MyClass::doSomething()
as with Db
? I see that index.php calls application/start.php which eventually initialised $app
- but I do not know when Facades have been activated or classes like Connection
have been bound to the Facade. And I could use help on this. Thanks.