-2

I'm using Laravel Localization for my project to manage multiple locales. Recently downloaded Laravel Spark for subscription management but can't make it work with Laravel Localization together. I would like my clients to access billing portal using the following url - .../{locale}/billing , I thought the localizationRedirect middleware should sort that but I've got 404. Could anyone please help to achieve that?

config/spark.php

return [

...
/*
    |--------------------------------------------------------------------------
    | Spark Path
    |--------------------------------------------------------------------------
    |
    | This configuration option determines the URI at which the Spark billing
    | portal is available. You are free to change this URI to a value that
    | you prefer. You shall link to this location from your application.
    |
    */
    'path' => 'billing',

    /*
    |--------------------------------------------------------------------------
    | Spark Middleware
    |--------------------------------------------------------------------------
    |
    | These are the middleware that requests to the Spark billing portal must
    | pass through before being accepted. Typically, the default list that
    | is defined below should be suitable for most Laravel applications.
    |
    */

    'middleware' => [
        'web',
        'auth',
        'localizationRedirect'
    ],
...

];
Deniss Muntjans
  • 369
  • 10
  • 35
  • Did you publish the configurations using artisan command? – Ghulam Farid Aug 07 '23 at 08:40
  • @GhulamFarid yes I did ```php artisan vendor:publish --tag=spark-lang``` – Deniss Muntjans Aug 07 '23 at 19:49
  • Please confirm me following? Are you using Laravel Localization method in your `web.php` to set the locale ? If you want to allow other languages other than en and es ( which by default are enabled) you've to publish the Laravel Localization configuration by running following, `php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"` and then un-comment the locale which you want to allow from `supportedLocales` array in your `config/laravellocalization.php`. – Ghulam Farid Aug 09 '23 at 05:44

1 Answers1

0

Sorted my issue by placing Stripe's routes under web.php

Route::group([
    'prefix' => LaravelLocalization::setLocale(),
    'middleware' => [
        'localeSessionRedirect',
        'localizationRedirect',
        'localeViewPath'
    ]
], function()
{
    // All my Routes
    ...........

    // Fortify Routes
    require base_path('vendor/laravel/fortify/routes/routes.php');

    // JetStream Routes
    require base_path('vendor/laravel/jetstream/routes/inertia.php');

    // Spark Routes
    require base_path('vendor/laravel/spark-stripe/routes/routes.php');
});
Deniss Muntjans
  • 369
  • 10
  • 35