All packages
Likes for Laravel
Exceptions
All package exceptions live in RoundlyConsulting\Likes\Exceptions:
| Exception | Thrown when |
|---|---|
InvalidReactionTypeException | A reaction type is not in likes.reactions — including a default_reaction missing from the list. |
NoAuthenticatedActorException | The facade, a PendingLike chain or @liked needs an actor, none was passed and actor_resolver resolves nothing. |
LikesException | Never directly — the abstract base of both, extending RuntimeException. Catch it to handle any package error. |
Catch the base class to turn any package error into a response:
use RoundlyConsulting\Likes\Exceptions\LikesException;
use RoundlyConsulting\Likes\Facades\Likes;
try {
Likes::as($request->string('reaction')->toString())->react($post);
} catch (LikesException $e) {
abort(422, $e->getMessage());
}The InteractsWithLikes testing helpers throw a plain RuntimeException when no liker is set — see Testing.
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.