Logo

dev-resources.site

for different kinds of informations.

Laravel: API Resources: With or Without "data"?

Published at
10/25/2023
Categories
laravel
php
mvc
eloquent
Author
akhilh2o
Categories
4 categories in total
laravel
open
php
open
mvc
open
eloquent
open
Author
8 person written this
akhilh2o
open
Laravel: API Resources: With or Without "data"?

If you use Eloquent API Resources to return data, they will be automatically wrapped in 'data'. If you want to remove it, add JsonResource::withoutWrapping(); in app/Providers/AppServiceProvider.php.

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        JsonResource::withoutWrapping();
    }
}
Enter fullscreen mode Exit fullscreen mode
eloquent Article's
30 articles in total
Favicon
Laravel Eloquent ORM in Bangla Part-3 (Models Retrieving)
Favicon
Prunable Eloquent Models
Favicon
Creating a Mini Blog API with Lithe and Eloquent
Favicon
Criando uma API de Mini Blog com Lithe e Eloquent
Favicon
Understanding Self-Relationships in Laravel Models: A Simple Guide
Favicon
Eloquent Trick: Laravel Model from Subquery
Favicon
Eloquent ORM: Accessor and Mutator
Favicon
Implementing User Suspension in Your Laravel Application
Favicon
Streamlining Eloquent Queries: Mastering User Scopes and Global Scopes in Laravel
Favicon
Getting data from resource responses before sending it to the client
Favicon
Including extra meta data with a resource response
Favicon
A Quick Intro To Eloquent Observers
Favicon
Customizing API Resource Pagination Structure
Favicon
What’s New in Laravel 11?
Favicon
Observing your integrity
Favicon
Laravel route binding for finite objects
Favicon
Simplify Slug Creation for Eloquent Models in Laravel
Favicon
Laravel: API Resources: With or Without "data"?
Favicon
Optimizing Laravel Eloquent queries
Favicon
Using Laravel push method to update your model and its relationships
Favicon
Laravel101: Exploring Entity-Model Relationships
Favicon
How to delete data from one to many relationship in Laravel?
Favicon
How to update a one-to-many relationship in Laravel?
Favicon
How can you retrieve data from a one-to-many relationship in Laravel?
Favicon
How to insert data in one to many relationship in database?
Favicon
How to create a One-To-Many relationship in Laravel?
Favicon
How to delete data from one to one relationship in Laravel?
Favicon
How to update a one-to-one relationship in Laravel?
Favicon
How can you retrieve data from a one-to-one relationship in Laravel?
Favicon
How to insert data in one to one relationship in database?

Featured ones: