app/Console/Commands/SeedStripeTaxRates.php
/**
     * Execute the console command.
     *
     * @return int
     */
Execute the console command.
@return int
Execute the console command . @return int
public function handle()
    {
        $rates = \json_decode(\file_get_contents(resource_path('data/vat-rates.json')), true);
        collect($rates['items'])
            ->map(fn ($rate) => $rate[0]['rates']['standard'])
            ->each(function ($percentage, $country) {
                \Stripe\TaxRate::create([
                    'display_name' => 'VAT',
                    'percentage'   => $percentage,
                    'inclusive'    => false,
                    'jurisdiction' => $country,
                    'description'  => 'VAT for '.locale_get_display_region('-'.$country, 'en'),
                ]);
            });
    }
public function handle ( ) { $ rates = \ json_decode ( \ file_get_contents ( resource_path ( 'data/vat-rates.json' ) ) , true ) ; collect ( $ rates [ 'items' ] ) -> map ( fn ( $ rate ) => $ rate [ 0 ] [ 'rates' ] [ 'standard' ] ) -> each ( function ( $ percentage , $ country ) { \ Stripe \ TaxRate :: create ( [ 'display_name' => 'VAT' , 'percentage' => $ percentage , 'inclusive' => false , 'jurisdiction' => $ country , 'description' => 'VAT for ' . locale_get_display_region ( '-' . $ country , 'en' ) , ] ) ; } ) ; }
Execute the console command.
Execute the console command .