Based on the information provided, it seems that the error "Undefined variable $biking" is occurring because the variable $biking is not being passed to the plans.blade.php view. To fix this, you need to make sure that the variable is passed to the view correctly.
Here's a possible solution:
In your SubscriptionController.php file, make sure that you are passing the $biking variable to the plans.blade.php view. You can do this by modifying the allPlans method as follows:
use App\Models\Plan;
public function allPlans()
{
$biking = Plan::where('type', 'biking')->get();
$hiking = Plan::where('type', 'hiking')->get();
$swimming = Plan::where('type', 'swimming')->get();
return view('plans', compact('biking', 'hiking', 'swimming'));
}
Make sure to import the Plan model at the top of the file.
Then, in your plans.blade.php file, you can access the $biking, $hiking, and $swimming variables using the @if directive like this:
@if($biking)
<!-- Display biking plans -->
@endif
@if($hiking)
<!-- Display hiking plans -->
@endif
@if($swimming)
<!-- Display swimming plans -->
@endif
Remember to replace the <!-- Display ... --> sections with your actual HTML code.
This should resolve the "Undefined variable $biking" error and allow you to display the plans to the user.