Skip to content

Support response type base on returned Resource #71

Closed
@szabi7

Description

@szabi7

Is any type of return properties list supported or we should execute an example request to be able to see the response format ?
I am using ...Resource classes (something like below) to be returned from each controller method response so the returned keys could be extracted the same way as they are for Request classes:

<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ClientResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => $this->id,
            'displayName' => $this->display_name,
        ];
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions