Skip to content

Commit

Permalink
Updates: config naming scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
DaltonMcCleery committed Jul 16, 2024
1 parent 048ab6f commit 94915e7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ REMOTE_MODELS_API_KEY="abcdefghijklmnopqrstuvwxyz"
```php
// config/remote-models.php
return [
'host_models' => [
'host-models' => [
\App\Models\Celebrity::class,
],
];
Expand Down Expand Up @@ -81,7 +81,7 @@ REMOTE_MODELS_API_KEY="abcdefghijklmnopqrstuvwxyz"
```php
// config/remote-models.php
return [
'host_models' => [
'host-models' => [
\App\Models\Celebrity::class,
],
];
Expand Down Expand Up @@ -147,7 +147,7 @@ REMOTE_MODELS_API_KEY="abcdefghijklmnopqrstuvwxyz"
```php
// config/remote-models.php
return [
'host_models' => [
'host-models' => [
// Nothing, you shouldn't put anything here for a Model with a custom endpoint.
// Otherwise, it will auto-create an API route.
],
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ install this package on the host application as well and enter the "remote" mode

```php
// config/remote-models.php
'host_models' => [
'host-models' => [
\App\Models\Celebrity::class
]
```
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Requests/RemoteModelRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function returnRemoteModels(): JsonResponse
return response()->json(status: 403);
}

if (\in_array($this->model, config('remote-models.host_models'))) {
if (\in_array($this->model, config('remote-models.host-models'))) {
return response()->json((new $this->model())::paginate());
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/remote-models.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

'api-key' => env('REMOTE_MODELS_API_KEY', null),

'host_models' => [
'host-models' => [
// \App\Models\User::class,
],
];
2 changes: 1 addition & 1 deletion tests/RemoteModelsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use function Pest\Laravel\{post};

it('does not register api endpoint with no models in config', function () {
Config::set('remote-models.host_models', []);
Config::set('remote-models.host-models', []);

$routeDoesntExist = route('remote-models.endpoint', ['model' => Celebrity::class]);
})
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function getEnvironmentSetUp($app): void

Config::set('remote-models.domain', 'https://yourdomain.com/');
Config::set('remote-models.api-key', 'abcdefghijklmnopqrstuvwxyz');
Config::set('remote-models.host_models', [
Config::set('remote-models.host-models', [
Celebrity::class,
]);
}
Expand Down

0 comments on commit 94915e7

Please sign in to comment.