Skip to content

Commit

Permalink
extendable
Browse files Browse the repository at this point in the history
  • Loading branch information
BSN4 committed Aug 13, 2022
1 parent 0aa19ff commit 4e1b746
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
6 changes: 3 additions & 3 deletions docs/3_installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ Laravel Visits can be configured to act the way you like, `config/visits.php` is
#### engine

```php
'engine' => 'redis',
'engine' => \Awssat\Visits\DataEngines\RedisEngine::class,
```

Suported data engines are `redis`, and `eloquent` currently.
If you use `eloquent` then data will be stored in the default database (MySQL, SQLite or the one you are using)
Suported data engines are `\Awssat\Visits\DataEngines\RedisEngine::class`, and `eloquent` currently.
If you use ` \Awssat\Visits\DataEngines\EloquentEngine::class` then data will be stored in the default database (MySQL, SQLite or the one you are using)

#### connection

Expand Down
11 changes: 1 addition & 10 deletions src/Visits.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,7 @@ public function __construct($subject = null, $tag = 'visits')

protected function determineConnection($name)
{
$connections = [
'redis' => \Awssat\Visits\DataEngines\RedisEngine::class,
'eloquent' => \Awssat\Visits\DataEngines\EloquentEngine::class
];

if(! array_key_exists($name, $connections)) {
throw new \Exception("(Laravel-Visits) The selected engine `{$name}` is not supported! Please correct this issue from config/visits.php.");
}

return app($connections[$name]);
return app($name);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/config/visits.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| Connection Name: see config/database.php
|
*/
'engine' => 'redis',
'engine' => \Awssat\Visits\DataEngines\RedisEngine::class,
'connection' => 'laravel-visits',


Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/EloquentPeriodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function setUp(): void
{
parent::setUp();

$this->app['config']['visits.engine'] = 'eloquent';
$this->app['config']['visits.engine'] = \Awssat\Visits\DataEngines\EloquentEngine::class;
$this->connection = app(\Awssat\Visits\DataEngines\EloquentEngine::class)
->setPrefix($this->app['config']['visits.keys_prefix']);
include_once __DIR__.'/../../database/migrations/create_visits_table.php.stub';
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/EloquentVisitsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function setUp(): void
{
parent::setUp();

$this->app['config']['visits.engine'] = 'eloquent';
$this->app['config']['visits.engine'] = \Awssat\Visits\DataEngines\EloquentEngine::class;
$this->connection = app(\Awssat\Visits\DataEngines\EloquentEngine::class)
->setPrefix($this->app['config']['visits.keys_prefix']);
include_once __DIR__.'/../../database/migrations/create_visits_table.php.stub';
Expand Down

0 comments on commit 4e1b746

Please sign in to comment.