Jun 29, 2018
0
Level 18
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
Please or to participate in this conversation.