Monday, 26 September 2022

Laravel add database table data to config folder files

 <?php


namespace App\Providers;

use App\Models\PaypalCredential;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}

/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->app['config']['paypal'] = [
'mode' => PaypalCredential::first()->paypal_mode, // Can only be 'sandbox' Or 'live'. If empty or invalid, 'live' will be used.
'sandbox' => [
'client_id' => PaypalCredential::first()->paypal_sandbox_client_id,
'client_secret' => PaypalCredential::first()->paypal_sandbox_client_secret,
'app_id' => 'APP-80W284485P519543T',
],
'live' => [
'client_id' => PaypalCredential::first()->paypal_live_client_id,
'client_secret' => PaypalCredential::first()->paypal_live_client_secret,
'app_id' => PaypalCredential::first()->paypal_live_app_id,
],
'payment_action' => env('PAYPAL_PAYMENT_ACTION', 'Order'), // Can only be 'Sale', 'Authorization' or 'Order'
'currency' => env('PAYPAL_CURRENCY', 'USD'),
'notify_url' => env('PAYPAL_NOTIFY_URL', ''), // Change this accordingly for your application.
'locale' => env('PAYPAL_LOCALE', 'en_US'), // force gateway language i.e. it_IT, es_ES, en_US ... (for express checkout only)
'validate_ssl' => env('PAYPAL_VALIDATE_SSL', true), // Validate SSL when creating api client.
];
}
}

No comments:

Post a Comment

Laravel Export data to csv

 use Illuminate\Http\Response; // Define a function to export data to CSV function exportToCSV($exportData, $columns) {     $filename = ...