Blade directive
The @liked conditional renders the right like-button state without glue code:
@liked($post)
<x-icon name="heart-filled" />
@else
<x-icon name="heart" />
@endliked- @liked($model) — uses the resolved actor.
- @liked($model, $actor) — honours an explicit actor.
- @liked($model, $actor, 'love') — honours a reaction type; without one, default_reaction is checked.
Guest-visible pages
Without an explicit actor, the directive resolves one like the facade does and throws NoAuthenticatedActorException when nothing resolves. On pages guests can see, wrap it in @auth or pass a non-null actor — a null actor falls back to resolution:
@auth
@liked($post)
<button>Unlike</button>
@else
<button>Like</button>
@endliked
@endauth
{{-- or pass an actor you already hold — it must be a model, not null --}}
@liked($post, $team, 'love')
<span>Your team loves this</span>
@endlikedThe directive is only registered if your app doesn’t already define a @liked directive. For feeds, prefer withLikedState() — it hydrates the same state for every row in one query.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.