trait TransformsToResource (View source)

Methods

toResource(string|null $resourceClass = null)

Create a new resource object for the given resource.

guessResource()

Guess the resource class for the model.

static array
guessResourceName()

Guess the resource class name for the model.

string|null
resolveResourceFromAttribute(string $class)

Get the resource class from the class attribute.

Details

JsonResource toResource(string|null $resourceClass = null)

Create a new resource object for the given resource.

Parameters

string|null $resourceClass

Return Value

JsonResource

protected JsonResource guessResource()

Guess the resource class for the model.

Return Value

JsonResource

static array guessResourceName()

Guess the resource class name for the model.

Return Value

array

protected string|null resolveResourceFromAttribute(string $class)

Get the resource class from the class attribute.

Parameters

string $class

Return Value

string|null