Stripe + Laravel -调用成员函数subscriptions()为空


Stripe + Laravel - Call to a member function subscribed() on null

这是非常奇怪的,我的订阅网站昨天工作,但今天它给我的错误-调用成员函数subscriptions()在null

我在最后一天检查了我编辑过的代码,没有什么明显的问题。

My code is…

@if (!$user->subscribed())
    <h1>You are not currently subscribed!</h1>
    <a href="plans" class="btn btn-green btn-lg  btn-large">SUBSCRIBE</a>
@elseif(Auth::guest())
     <h1>You need to be a member to view todays tips!</h1>
     <a href="login" class="btn btn-green btn-lg  btn-large">LOGIN</a>
     <a href="register" class="btn btn-blue btn-lg  btn-large">REGISTER</a>
                @else
    @forelse($todaystips as $tip)
        <h3>{{ $tip->league }}</h3>
        <h2>{{ $tip->home_team }} V {{ $tip->away_team }}</h2>
        <h3><b>{{ $tip->tip }}</b>  {{ $tip->odds }}</h3>
        @empty<h1>There are no tips today! Check back tomorrow!</h1>
     @endforelse
@endif

,控制器代码为

public function home()
{
    $user = Auth::user();
    return view('home')->with(['user' => $user,]);
}

在使用Auth::user()之前需要检查Auth::check()

像这样:

@if (Auth::check() && !$user->subscribed())