mark

Api Ref

Usage With Laravel

Check each Marker and markables traits for full list of available usages, the following is a sample:

Marker

to get Markables related to the marker, (User and posts), use these methods

Note: metadata parameter is optional

1$post = Post::first();
2 
3auth()->user()->like($post, metadata: []);
4auth()->user()->dislike($post, metadata: []);
5auth()->user()->hasLiked($post);
6auth()->user()->markLike($post, value: true, metadata: []);
7auth()->user()->unmarkLike($post);

Markable:

to get related to the post

1$user = auth()->user();
2$post->likeBy($user, metadata: []);
3$post->dislikeBy($user, metadata: []);
4$post->isLikedBy($user);
5$post->markLike($user, value: true, metadata: []);
6$post->unmarkLike($user);

Trait Reference

here is a list of all the Markable/Marker Trait API Reference

Likes

🧩 Type 🧱 Trait ⚙️ Method
Markable Relations likedBy
likes
like
Actions unmarkLike
likeBy
dislikeBy
Scopes scopeWhereLikedOrDislikedBy
scopeWhereLikedBy
scopeWhereDislikedBy
Indicators isLikedBy
isDislikedBy
isLikedOrDislikedBy
Marker Relations likes
Actions markLike
unmarkLike
like
dislike
Scopes scopeWhereLikedOrDisliked
scopeWhereLiked
scopeWhereDisliked
Indicators hasLiked
hasDisliked
hasLikedOrDisliked

Bookmarks:

🧩 Type 🧱 Trait ⚙️ Method
Markable Relations bookmarkedBy
bookmarks
bookmark
Actions unmarkBookmark
bookmarkBy
Scopes scopeWhereBookmarkedBy
Indicators isBookmarkedBy
Marker Relations bookmarks
Actions markBookmark
unmarkBookmark
bookmark
Scopes scopeWhereBookmarked
Indicators hasBookmarked

Rating:

🧩 Type 🧱 Trait ⚙️ Method
Markable Relations ratedBy
ratings
rating
Actions unmarkRating
rateBy
Scopes scopeWhereRatedBy
Indicators isRatedBy
Marker Relations ratings
Actions markRating
unmarkRating
rate
Scopes scopeWhereRated
Indicators hasRated

Zeus is an open-source project. Thanks to my sponsors for helping me maintain this project.