How to use
Prerequisite
You are either working inside a regular Laravel Application or inside a Athenaeum Core Application.
Example
Imagine that you have a component that depends on Laravel's configuration Repository
. To obtain the bound instance, use the ConfigTrait
.
use Aedart\Support\Helpers\Config\ConfigTrait;
class Box
{
use ConfigTrait;
// ... remaining not shown ... //
}
As soon as you invoke the getter method (getConfig()
), a local reference to the bound Repository
is obtained from the Service Container.
$box = new Box();
$config = $box->getConfig();
You can also specify a custom Repository
, should you wish it.
$box->setConfig($myCustomRepository);