Attempt to read property "id" on null
Cannot provide help with the limited information given. Where does the error occur? When is it triggered?
Most importantly, what does it say? Which line and file did the error occur, that information should be included in the errors stack trace.
What day of the course did this error occur? Is it solved by the course for the next day?
The plan you are trying to update to doesn't exist in your database.
You can change to firstOrFail()
instead of first()
to make sure the billing update fails if a user tried to update to a plan that doesn't exist. Or check if the $plan
fails with an if statement.
if (!$plan) {
}
Make sure you've migrated the latest migrations and used the PlansTableSeeder
with artisan db:seed
to seed the demo plans as per the day 8 video.
Also make sure the radio input contains the value
attribute with the plan name and that the checkbox name
attribute is set to plan
.
<input type="radio" id="{{ $plan->name }}-plan" name="plan" value="{{ $plan->name }}">