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.

Details

JsonResource toResource(string|null $resourceClass = null)

Create a new resource object for the given resource.

Parameters

string|null $resourceClass

Return Value

JsonResource

Exceptions

Throwable

protected JsonResource guessResource()

Guess the resource class for the model.

Return Value

JsonResource

Exceptions

Throwable

static array guessResourceName()

Guess the resource class name for the model.

Return Value

array