Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rameezisrar's avatar

Laravel Spark not getting me any plan from the data source

I am getting $pid as product id from the URL. dd($products) getting me one 1 specific product as I got from the URL but the plans don't show up. I am only getting the registration form and nothing.

I am not getting any log error or console error.

If i remove the second where clouse i:e

$products = Product::where('publish',1)->get();

then everything works fine. However i need to show one product only

SparkServiceProvider

$pid = session('pid');
Spark::useStripe();
        Spark::collectBillingAddress();
   
        $products = Product::where('publish',1)->where('id',$pid)->get();

foreach ($products as $product) {
            Spark::plan($product->name, $product->plan_id)
            ->price($product->price);
      
        }// foreach ended
0 likes
0 replies

Please or to participate in this conversation.