You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for all your hard work on this, I'm really excited about using it in a future project.
As someone very new to Laravel I'm reluctant to open this ticket, however as a WordPress developer (for ~15 years) I feel obligated to mention the differences between "actions" and "filters" isn't demonstrated well within the examples, since they're practically the same.
I'd suggest passing variables in hooks, otherwise it's just a filter. This would help not only with differentiate the two but show the power of creating an action hook.
use TorMorten\Eventy\Facades\Events as Eventy;
Eventy::action('my.hook', $user);
use TorMorten\Eventy\Facades\Events as Eventy;
class SharePostsController
{
public function boot()
{
Eventy::addAction('blade-posts-loop-post', function($post) {
echo '<a href="'.$post->url.'">Share this post</a>';
printf('<a href="https://xyz.com?share='.$post->url.'">Share this post</a>');
});
}
}
use TorMorten\Eventy\Facades\Events as Eventy;
class CommentsPostsController
{
public function boot()
{
Eventy::addAction('blade-posts-loop-post', function($post) {
echo 'Comments: ' . count($post->comments);
});
}
}
The text was updated successfully, but these errors were encountered:
Thank you for all your hard work on this, I'm really excited about using it in a future project.
As someone very new to Laravel I'm reluctant to open this ticket, however as a WordPress developer (for ~15 years) I feel obligated to mention the differences between "actions" and "filters" isn't demonstrated well within the examples, since they're practically the same.
I'd suggest passing variables in hooks, otherwise it's just a filter. This would help not only with differentiate the two but show the power of creating an action hook.
Especially in regards to templating.
Maybe an example you can use for "Using it to enable extensibility".
Here's an example of an action being added to the a blade template for extensibility by plugins that can be conditionally loaded.
The text was updated successfully, but these errors were encountered: