Laravel 11 - Eloquent API Resources - Part 5

preview_player
Показать описание
In this video, you will learn how to use Eloquent API Resouces. What is API Resources, why do we need API Resource and wha is important point of API Resources. When building an API, you may need a transformation layer that sits between your Eloquent models and the JSON responses that are actually returned to your application's users. For example, you may wish to display certain attributes for a subset of users and not others, or you may wish to always include certain relationships in the JSON representation of your models. Eloquent's resource classes allow you to expressively and easily transform your models and model collections into JSON.
Рекомендации по теме