Monday, 26 September 2022

laravel paypal links

 https://srmklive.github.io/laravel-paypal/docs.html


https://www.positronx.io/how-to-integrate-paypal-payment-gateway-in-laravel/


https://dev.to/alamriku/how-to-integrate-paypal-payment-gateway-in-laravel-8-x-ba6


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.
];
}
}

Thursday, 1 September 2022

Php filter string

 function FilterString($str)

{

     $aftertrim=trim($str);

    $afterstrip= strip_tags($aftertrim);

    $agintrim=trim($afterstrip);

    $afterremovesapce=strtolower(str_replace(" ","_",$agintrim));

    $removeSpecialChar = preg_replace('/[0-9\@\.\;\" "\?]+/', '', $afterremovesapce);

    //$strlen=strlen($removeSpecialChar);

   if(strlen($removeSpecialChar) > 23)

   {

    $checklast= substr($removeSpecialChar,0,24);

   }

    //$afterGarbageremove=gc_disable($checklast);

     $agintrim=trim($checklast);

    //$lastchar=$checklast[1];

    

    

  $lastchar= substr($agintrim, strlen($agintrim)-1);

    if($lastchar== '_')

    {

     $isexistlen=strlen($checklast);

     $finalstring=substr($checklast,0,$isexistlen-1 );

     $returnString= $finalstring;

    }else

    {

      $returnString= $agintrim;

    }

    return $returnString;

}

Laravel Export data to csv

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