Skip to main content

Search Results for "API resources"

We found 17 results for "API resources".

Course Lesson Flutter 3 Mobile App with Laravel 12 API Premium

02 - Creating Eloquent API Resource and Finishing CRUD

In this lesson, we will take on two tasks: Implementing Laravel Eloquent API Resource Implementing CRUD operations for the Category model At the end of this lesson, we will have a fully working CRUD for the Category model with transformed API responses: Creating First Resource Let's start by creating our first resource using the artisan command: php artisan make:resource CategoryResource This will create a scaffold for our resource: app/Http/Resources/CategoryResource.php use Illuminate\Http\Request;use Illuminate\Http\Resources\Json\JsonResource; class CategoryResource extends JsonResource{ /** * Transform the resource into an array

Haven't found what you're looking for?

Our team is here to help. Ask us anything about Laravel development and we'll get back to you with personalized guidance.

Ask for Personal Help

We'll respond within 24 hours

Function available only for premium members.

Be as specific as possible so we can provide the best guidance.

Video Free

Laravel API Resources: 3 More Complex Examples

Eloquent API Resources are typically used to transform API results into the format that you need, but did you know about more complex conditions and relationship structures that you can use in the API Resource class? I will show you 3 open-source examples.

Code Example monicahq/monica

monicahq/monica

Files in the example:

  • app/Http/Resources/Company/Company.php
  • app/Http/Controllers/Api/Account/ApiCompanyController.php
Code Example devhub-az/devhub

devhub-az/devhub

Files in the example:

  • routes/api.php
  • app/Http/Controllers/Api/ArticleController.php
  • app/Http/Resources/ArticlesResource.php
  • app/Http/Resources/ArticleResource.php
Code Example codenteq/laerx

codenteq/laerx

Files in the example:

  • app/Http/Resources/QuestionResource.php
  • app/Http/Controllers/API/QuestionController.php

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.