Level 29
Is this a one to many relationship? If yes then you need to check it like thattt
@if(Auth::user()->subscriptions()->count())
<p>abonne</p>
@else
<p>pas abonne</p>
@endif
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello, I am having a problem. In blade I try to see if the user is subscribed or not. For this I use
@if(Auth::user()->subscriptions())
<p>abonne</p>
@else
<p>pas abonne</p>
@endif
If subscription has an "s" at the end, I am marked as subscribed. If there is not the "s" I am marked as not subscribed.
In the subscription table I do have a subscription row.
How to solve this problem
I have create my subscription with
$user->subscriptions()->create([
'name' => 'default',
'stripe_id' => $data['subscription'],
'stripe_status' => 'active',
'stripe_plan' => $data['metadata']['stripe_plan'],
'quantity' => 1,
'trial_ends_at' => null,
'ends_at' => null,
]);
thanks
Please or to participate in this conversation.