Deniss Muntjans
Deniss Muntjans

Reputation: 379

Laravel Spark with Laravel Localization

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'
    ],
...

];

Upvotes: -2

Views: 197

Answers (1)

Deniss Muntjans
Deniss Muntjans

Reputation: 379

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');
});

Upvotes: 0

Related Questions