Category: Laravel, api, javascript

In this post I’ll show how to build a Rating component using Laravel Livewire. Laravel Livewire is a framework on top of Laravel to build dynamic applications without leaving the “comfort” of Laravel.

This is a preview of the complete application: In the red box I’ve highlighted the Rating component: You can click on the stars to give your rating, and both your rating and the average rating of all users is updated and displayed.

First, enable your pages to host Livewire components editing resources/views/layouts/app.blade.php and adding: Now, you can create the Rating component: The Rating component is split into a Blade template and a server-side component.

Keep in mind that a Livewire component is an end-to-end component, whereas a React/Vue component needs an API to interact with the back end.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners