feat: ✨ Set Re-Captcha and Discord config at boot-time
This commit is contained in:
parent
881d3e4b45
commit
8d03cf8322
1 changed files with 10 additions and 4 deletions
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use App\Models\Settings;
|
||||||
use Illuminate\Pagination\Paginator;
|
use Illuminate\Pagination\Paginator;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Spatie\QueryBuilder\QueryBuilderRequest;
|
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
@ -31,14 +32,11 @@ class AppServiceProvider extends ServiceProvider
|
||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
|
|
||||||
Validator::extend('multiple_date_format', function ($attribute, $value, $parameters, $validator) {
|
Validator::extend('multiple_date_format', function ($attribute, $value, $parameters, $validator) {
|
||||||
|
|
||||||
$ok = true;
|
$ok = true;
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
// iterate through all formats
|
// iterate through all formats
|
||||||
foreach ($parameters as $parameter) {
|
foreach ($parameters as $parameter) {
|
||||||
|
|
||||||
//validate with laravels standard date format validation
|
//validate with laravels standard date format validation
|
||||||
$result[] = $validator->validateDateFormat($attribute, $value, [$parameter]);
|
$result[] = $validator->validateDateFormat($attribute, $value, [$parameter]);
|
||||||
}
|
}
|
||||||
|
@ -51,5 +49,13 @@ class AppServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
return $ok;
|
return $ok;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Set Discord-API Config
|
||||||
|
config(['services.discord.client_id' => Settings::getValueByKey('SETTINGS::DISCORD:CLIENT_ID')]);
|
||||||
|
config(['services.discord.client_secret' => Settings::getValueByKey('SETTINGS::DISCORD:CLIENT_SECRET')]);
|
||||||
|
|
||||||
|
//// Set Recaptcha API Config
|
||||||
|
config(['recaptcha.api_site_key' => Settings::getValueByKey('SETTINGS::RECAPTCHA:SITE_KEY')]);
|
||||||
|
config(['recaptcha.api_secret_key' => Settings::getValueByKey('SETTINGS::RECAPTCHA:SECRET_KEY')]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue