Skip to content

Commit ef1383e

Browse files
committed
Refactor config to remove env defaults and update docs
Updated the configuration to use null defaults instead of environment variables for 'app_name' and GitHub settings. Adjusted the README to reflect these changes and clarified configuration instructions. Modified the Blade view to fallback to 'app.name' if 'app_name' is not set in the plugin config.
1 parent c7bf012 commit ef1383e

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ First, you can start to install the package via composer:
4848
composer require devonab/filament-easy-footer:^2.0
4949
```
5050

51-
You can publish the config file with:
51+
You can publish the config file with. This file is needed if you want to change the default:
5252

5353
```bash
5454
php artisan vendor:publish --tag="filament-easy-footer-config"
@@ -64,11 +64,12 @@ This is the contents of the published config file:
6464

6565
```php
6666
return [
67-
'app_name' => env('APP_NAME', 'Filament Footer'),
67+
'app_name' => null,
68+
6869
'github' => [
69-
'repository' => env('GITHUB_REPOSITORY', ''),
70-
'token' => env('GITHUB_TOKEN', ''),
71-
'cache_ttl' => env('GITHUB_CACHE_TTL', 3600)
70+
'repository' => null,
71+
'token' => null,
72+
'cache_ttl' => 3600,
7273
],
7374
];
7475
```
@@ -171,7 +172,7 @@ use Devonab\FilamentEasyFooter\EasyFooterPlugin;
171172
### Custom sentence
172173
![Filament Easy Footer custom sentence](https://raw.githubusercontent.com/Devonab/filament-easy-footer/main/art/custom_sentence.webp)
173174

174-
By default, the plugin will display the name of your application (configured from your .ENV) next to the copyright. You can change the phrase by publishing the plugin configuration file.
175+
By default, the plugin will display the name of your application (configured from your .ENV), or the app_name key in the plugin config file,next to the copyright. You can change the phrase by publishing the plugin configuration file.
175176

176177
If you prefer a more personalized approach, you can use the following method:
177178

@@ -214,13 +215,20 @@ use Devonab\FilamentEasyFooter\EasyFooterPlugin;
214215
- showLogo : Display the GitHub logo next to the version
215216
- showUrl : Add an `<a>` tag to the Github URL around the logo
216217

217-
To make this one work, you need to add this keys to our .env file :
218+
To make this one work, you need to publish the plugin configuration file and set the following keys :
218219

219-
```bash
220-
GITHUB_REPOSITORY=user/name-of-the-repo
221-
GITHUB_TOKEN= # Recommended but not compulsory for all repos, required for private repos
222-
GITHUB_CACHE_TTL= # in seconds, 3600 by default
220+
```php
221+
return [
222+
'app_name' => null,
223+
224+
'github' => [
225+
'repository' => null, #user/name-of-the-repo
226+
'token' => null, # Recommended but not compulsory for all repos, required for private repos
227+
'cache_ttl' => 3600, # in seconds, 3600 by default
228+
],
229+
];
223230
```
231+
224232
If needed, you can generate a token [here](https://github.com/settings/personal-access-tokens). The token need to have at least the `read-only` permission on the "Contents" scope in Repository permissions.
225233

226234
### Load time

config/filament-easy-footer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

33
return [
4-
'app_name' => env('APP_NAME', 'Filament Footer'),
4+
'app_name' => null,
5+
56
'github' => [
6-
'repository' => env('GITHUB_REPOSITORY', ''),
7-
'token' => env('GITHUB_TOKEN', ''),
8-
'cache_ttl' => env('GITHUB_CACHE_TTL', 3600),
7+
'repository' => null,
8+
'token' => null,
9+
'cache_ttl' => 3600,
910
],
1011
];

resources/views/easy-footer.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
{{ $sentence }}
4343
@endif
4444
@else
45-
{{ config('filament-easy-footer.app_name') }}
45+
{{ config('filament-easy-footer.app_name') ?? config('app.name') }}
4646
@endif
4747
</span>
4848

0 commit comments

Comments
 (0)