Laravel Bandwagon is a package to help promote social proof and legitimacy within your application. You can let users of your application know when others’ share, purchase, subscribe, or donate, for example:
Using blade and Vue, here’s how easy it is to feed data into the social proof component, which is then displayed in the user’s browser via polling:
1use Bndwgn\Bandwagon\Bandwagon; 2 3public function purchase(Request $request, Product $product) 4{ 5 $user = Auth::user(); 6 // ... logic to charge a customer 7 Bandwagon::createEvent( 8 "Someone from ${$user->state}", 9 "Purchased the ${$product->displayName} plan",10 $request->ip()11 );12}
In your blade template (i.e., on your product page), you render the widget by using the provided blade component:
1<x-bandwagon-renderer />
The package allows you to configure things like poll increments (how often to check for new events), how long to display events, and the age of valid events.
Bandwagon’s documentation is available on www.laravelbandwagon.com, and you can learn more about this package’s source code on GitHub.
0 comments:
Post a Comment
Thanks