TransformsToResource
trait TransformsToResource
Provides the ability to transform a model to a JSON resource.
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 UseResource attribute.
Details
at line 23
JsonResource
toResource(string|null $resourceClass = null)
Create a new resource object for the given resource.
at line 35
protected JsonResource
guessResource()
Guess the resource class for the model.
at line 58
static array
guessResourceName()
Guess the resource class name for the model.
at line 88
protected string|null
resolveResourceFromAttribute(string $class)
Get the resource class from the UseResource attribute.