generated from likesistemas/composer-empty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from likesistemas/hotfix/fix-use-container
✨ Adding container resolution using `illuminate\container`
- Loading branch information
Showing
3 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# [Eloquent] Using Eloquent without any dependency on Laravel Framework [![CI](https://github.com/likesistemas/eloquent-external/actions/workflows/ci.yml/badge.svg)](https://github.com/likesistemas/eloquent-external/actions/workflows/ci.yml) | ||
|
||
## Installation | ||
|
||
``` | ||
composer require likesistemas/eloquent-external --dev | ||
``` | ||
|
||
## How to use | ||
|
||
### Using class `ConfigBean` | ||
|
||
```php | ||
|
||
use Illuminate\Container\Container; | ||
use Like\Database\Config; | ||
use Like\Database\ConfigBean; | ||
use Like\Database\Eloquent; | ||
|
||
$config = new ConfigBean( | ||
'host', | ||
'user', | ||
'password', | ||
'db_name' | ||
); | ||
$config->setFactoryFolder(__DIR__ . "/./factories/"); # Folder where all the Eloquent factories are. | ||
$config->addFakerProvider(ProdutoProvider::class); # Optional. Use to add new providers to Faker. Note: you can add as many as you like. | ||
|
||
# If you are configuring the settings in the same file that will start, you can pass the config by parameter. | ||
Eloquent::init($config); | ||
|
||
# Or set using `illuminate\container` and run init without parameter. | ||
Container::getInstance()->instance(Config::class, $config); | ||
# Then call `init` wherever you think is best, without having to pass parameters. | ||
Eloquent::init(); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters