Courses

React.js + Inertia in Laravel 11: From Scratch

Protect Your Inertia Data with API Resources

Summary of this lesson:
- Use API Resources with Inertia
- Transform and limit data passed to frontend
- Control data visibility and security
- Format data before sending to React
- Prevent accidental data exposure

In this lesson, I want to show that you can still use API resources or Eloquent API resources to transform that data, although you don't use API directly.


Why Use API Resources?

For example, in the initial project, using React with API, the content was stripped to 50 symbols and the created at date was formatted as a date time string. For that, the API Eloquent resources were used. API resources can also be used with Inertia.

Why do you need to do that? There are two reasons:

  1. Format the data however you want.
  2. Limiting data that is passed to the front-end.

Keep in mind that all that data is passed to...

The full lesson is only for Premium Members.
Want to access all 18 lessons of this course? (57 min read)

You also get:

  • 69 courses (majority in latest Laravel 11)
  • Premium tutorials
  • Access to repositories
  • Private Discord