O'Reilly logo

Lumen Programming Guide: Writing PHP Microservices, REST and Web Service APIs by Paul Redmond

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Paul Redmond 2016

Paul Redmond, Lumen Programming Guide, 10.1007/978-1-4842-2187-7_12

12. Ratings

Paul Redmond

(1)Phoenix, Arizona, USA

The final chapter will focus on adding the ability to rate things. When you think of ratings, you might think of book ratings, but actually you can apply ratings to multiple things. Specifically, you will add ratings to authors. Using Eloquent makes it easy to apply data like ratings to multiple models (as you will see shortly) using polymorphic relationships ( https://laravel.com/docs/5.2/eloquent-relationships#polymorphic-relations ). Polymorphic relationships allow a model (ratings) to belong to more than one model. In the context of your API, ratings make sense for authors, books, and bundles.

Your ratings ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required