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

jpeterson579's avatar

Upgraded spark app and laravel now getting Trying to get property of non-object after log in.

Hi everyone! So I upgraded my spark application to laravel 5.3 and newest version of spark and now I am getting

ErrorException in Billable.php line 191: 
Trying to get property of non-object (View: /Applications/MAMP/htdocs/laravel3/resources/views/vendor/spark/nav/subscriptions.blade.php) (View: /Applications/MAMP/htdocs/laravel3/resources/views/vendor/spark/nav/subscriptions.blade.php) (View: /Applications/MAMP/htdocs/laravel3/resources/views/vendor/spark/nav/subscriptions.blade.php)

on all my pages after I log in. I narrowed it down to the following line of code that if causing the problem but I dont know what could be the issue as this works fine on my other install of laravel 5.2 with a older version of spark.

resources/views/vendor/spark/nav/subscriptions.blade.php

@if (Auth::user()->onTrial())
<!-- Trial Reminder -->
<li class="dropdown-header">Trial</li>

<li>
    <a href="/settings#/subscription">
        <i class="fa fa-fw fa-btn fa-shopping-bag"></i>Subscribe
    </a>
</li>

<li class="divider"></li>
@endif
0 likes
2 replies
ejdelmonico's avatar

There have been many small changes. I would just start comparing code with repo. I have found that the upgrade process requires a painstaking code check because of inconsistencies.

Also, I think its looking for the plan called default unless you tell it otherwise in 3.0. It seems unlikely that the template is causing the issue. Make sure Auth::user() is not the issue.

jpeterson579's avatar
jpeterson579
OP
Best Answer
Level 7

Ok so here was the fix. I had to rerun all migrations and then it worked. I guess there is some new stuff in the tables...

I also had to update my composer.json file for the latest version of cashier. I assumed that with a fresh update of spark this would have been done already...

1 like

Please or to participate in this conversation.