mark

Filament

Form Field

to use Lara Zeus mark in your forms:

using mark component in forms
1use LaraZeus\Mark\Forms\Components\Mark;
2use App\Models\Like;
3 
4Mark::make('like')
5 
6 // ready to use marks
7 ->like()
8 ->bookmark()
9 ->rating()
10 
11 // custom marks
12 ->icons([
13 true => 'heroicon-o-hand-thumb-up',
14 false => 'heroicon-o-hand-thumb-down',
15 ])
16 ->selectedIcons([
17 true => 'heroicon-s-hand-thumb-up',
18 false => 'heroicon-s-hand-thumb-down',
19 ])
20 
21 // relationships
22 ->relationship() // default uses component name
23 ->relationship(name: 'like')
24 ->relationship(metadata: fn($record) => ['name' => $record->name])

Laravel

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

1use LaraZeus\Mark\Forms\Components\Mark;
2use App\Models\Like;
3 
4// Marker samples
5 
6// Note: metadata parameter is optional
7$post = Post::first();
8 
9auth()->user()->like($post, metadata: []);
10auth()->user()->dislike($post, metadata: []);
11auth()->user()->hasLiked($post);
12auth()->user()->markLike($post, value: true, metadata: []);
13auth()->user()->unmarkLike($post);
14 
15// Markable samples
16 
17// Note: metadata parameter is optional
18$user = auth()->user();
19$post->likeBy($user, metadata: []);
20$post->dislikeBy($user, metadata: []);
21$post->isLikedBy($user);
22$post->markLike($user, value: true, metadata: []);
23$post->unmarkLike($user);

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