Alright, will figure something out Thanks for all the help!
I tried here and this worked, note that the method is just int()
:
$likesCount = $post->likes()->int();
$likesCount++;
1 Like
Thanks a lot for correcting the typo.
1 Like
Callback in $page->update() has just been added to the development branch and will be included in the next release. Also coming with the next release, two handy functions for this topic:
$page->increment('likes');
$page->increment('likes', $by = 10);
$page->increment('likes', $by = 10, $max = 1000);
$page->decrement('likes');
$page->decrement('likes', $by = 10);
$page->decrement('likes', $by = 10, $min = 0);
5 Likes