Two API Things that Laravel Automates For Us

  • Laravel automates JSON serialization: If you return an Eloquent collection or model directly from your controllers or routes, Laravel will automatically transform that to JSON.
  • Laravel automates hiding sensitive fields: In the process of serialization, Laravel will hide all the fields that you specify in the 'hidden' array of your Eloquent model.

via Two API Things that Laravel Automates For Us