[{"data":1,"prerenderedAt":1573},["ShallowReactive",2],{"libs":3,"navigation-laravel-json-api":115,"\u002Flaravel-json-api\u002Fresources\u002Fanatomy":294,"\u002Flaravel-json-api\u002Fresources\u002Fanatomy-surround":1568},[4,45,69,95],{"id":5,"color":6,"compatibility":7,"extension":20,"icon":21,"links":22,"meta":27,"name":28,"order":29,"package":30,"related":31,"stem":34,"tagline":35,"__hash__":36,"slug":37,"repository":38,"branch":39,"path":40,"collection":41,"entry":42,"home":43,"version":44},"laravel_json_api_meta\u002Fdocs\u002Fsite\u002Flib.yml","violet",[8,13,16],{"version":9,"php":10,"laravel":11,"status":12},"3.x","^8.3","^12.46 || ^13.0","active",{"version":14,"php":10,"laravel":11,"status":15},"2.x","eol",{"version":17,"php":18,"laravel":19,"status":15},"1.x","^8.1","^10.0 || ^11.0 || ^12.0 || ^13.0","yml","i-lucide-braces",[23],{"label":24,"to":25,"icon":26},"JSON:API 1.1","https:\u002F\u002Fjsonapi.org\u002Fformat\u002F","i-lucide-book-marked",{},"Laravel JSON:API",10,"ark4ne\u002Flaravel-json-api",[32,33],"laravel-api-revisions","laravel-openapi-generator","docs\u002Fsite\u002Flib","JSON:API 1.1 resources for Laravel, with typed values, validated includes and fieldsets, and API revisions.","ILGoVp9rzKYDQc18VV8kkXy3EQOQ8rv87JblFKXYDrU","laravel-json-api","Ark4ne\u002Flaravel-json-api","master","docs\u002Fsite","laravel_json_api","\u002Flaravel-json-api\u002Fgetting-started\u002Fintroduction","\u002Flaravel-json-api","v3.0.0",{"id":46,"color":47,"compatibility":48,"extension":20,"icon":50,"links":51,"meta":56,"name":57,"order":58,"package":59,"related":60,"stem":34,"tagline":61,"__hash__":62,"slug":32,"repository":63,"branch":64,"path":40,"collection":65,"entry":66,"home":67,"version":68},"laravel_api_revisions_meta\u002Fdocs\u002Fsite\u002Flib.yml","amber",[49],{"version":17,"php":10,"laravel":11,"status":12},"i-lucide-git-branch",[52],{"label":53,"to":54,"icon":55},"Agent skill","https:\u002F\u002Fgithub.com\u002FArk4ne\u002Flaravel-api-revisions\u002Ftree\u002Fmain\u002Fskills\u002Flaravel-api-revisions","i-lucide-bot",{},"Laravel API Revisions",20,"ark4ne\u002Flaravel-api-revisions",[37,33],"Typed schemas for Laravel resources and form requests, evolved through dated API revisions, Stripe-style.","w24MBVK4_XliIZ8nVcfnuT9OgR-m-Ytxz31Pxua_mLM","Ark4ne\u002Flaravel-api-revisions","main","laravel_api_revisions","\u002Flaravel-api-revisions\u002Fgetting-started\u002Fintroduction","\u002Flaravel-api-revisions","v1.0.0",{"id":70,"color":71,"compatibility":72,"extension":20,"icon":77,"links":78,"meta":82,"name":83,"order":84,"package":85,"related":86,"stem":34,"tagline":88,"__hash__":89,"slug":33,"repository":90,"branch":39,"path":40,"collection":91,"entry":92,"home":93,"version":94},"laravel_openapi_generator_meta\u002Fdocs\u002Fsite\u002Flib.yml","emerald",[73,75],{"version":17,"php":10,"laravel":74,"status":12},"^13.0",{"version":76,"php":18,"laravel":19,"status":15},"0.6","i-lucide-file-json",[79],{"label":80,"to":81,"icon":26},"OpenAPI Specification","https:\u002F\u002Fspec.openapis.org\u002Foas\u002Flatest.html",{},"Laravel OpenAPI Generator",30,"ark4ne\u002Flaravel-openapi-generator",[87,37,32],"openapi-writer","Generates OpenAPI 3.0, 3.1 and 3.2 documents from a Laravel application, its routes, form requests and resources.","DTt0SVqegMImLmWmwL8LCW5lxRCWFYcnBFOaquLpVwc","Ark4ne\u002Flaravel-openapi-generator","laravel_openapi_generator","\u002Flaravel-openapi-generator\u002Fgetting-started\u002Fintroduction","\u002Flaravel-openapi-generator","v1.2.0",{"id":96,"color":97,"compatibility":98,"extension":20,"icon":101,"links":102,"meta":104,"name":105,"order":106,"package":107,"related":108,"stem":34,"tagline":109,"__hash__":110,"slug":87,"repository":111,"branch":64,"path":40,"collection":112,"entry":113,"home":114,"version":68},"openapi_writer_meta\u002Fdocs\u002Fsite\u002Flib.yml","sky",[99],{"version":17,"php":100,"status":12},"^8.2","i-lucide-file-pen-line",[103],{"label":80,"to":81,"icon":26},{},"OpenAPI Writer",40,"ark4ne\u002Fopenapi-writer",[33],"Framework-agnostic, fluent and immutable PHP builder for OpenAPI 3.0, 3.1 and 3.2 documents, written as JSON or YAML and validated.","JFQcdQ9GEChOkfRKibLjoxZOfnt6HYNsayX2melOzMk","Ark4ne\u002Fopenapi-writer","openapi_writer","\u002Fopenapi-writer\u002Fgetting-started\u002Fintroduction","\u002Fopenapi-writer",[116,135,165,187,216,234,248,282],{"title":117,"since":118,"experimental":119,"icon":120,"path":121,"stem":122,"children":123,"page":119},"Getting started",null,false,"i-lucide-rocket","\u002Flaravel-json-api\u002Fgetting-started","laravel-json-api\u002F1.getting-started",[124,127,131],{"title":125,"path":42,"stem":126,"since":118,"experimental":119},"Introduction","laravel-json-api\u002F1.getting-started\u002F1.introduction",{"title":128,"path":129,"stem":130,"since":118,"experimental":119},"Installation","\u002Flaravel-json-api\u002Fgetting-started\u002Finstallation","laravel-json-api\u002F1.getting-started\u002F2.installation",{"title":132,"path":133,"stem":134,"since":118,"experimental":119},"Quick start","\u002Flaravel-json-api\u002Fgetting-started\u002Fquick-start","laravel-json-api\u002F1.getting-started\u002F3.quick-start",{"title":136,"since":118,"experimental":119,"icon":137,"path":138,"stem":139,"children":140,"page":119},"Resources","i-lucide-box","\u002Flaravel-json-api\u002Fresources","laravel-json-api\u002F2.resources",[141,145,149,153,157,161],{"title":142,"path":143,"stem":144,"since":118,"experimental":119},"Anatomy of a resource","\u002Flaravel-json-api\u002Fresources\u002Fanatomy","laravel-json-api\u002F2.resources\u002F1.anatomy",{"title":146,"path":147,"stem":148,"since":118,"experimental":119},"Attributes & values","\u002Flaravel-json-api\u002Fresources\u002Fattributes","laravel-json-api\u002F2.resources\u002F2.attributes",{"title":150,"path":151,"stem":152,"since":118,"experimental":119},"Conditions","\u002Flaravel-json-api\u002Fresources\u002Fconditions","laravel-json-api\u002F2.resources\u002F3.conditions",{"title":154,"path":155,"stem":156,"since":118,"experimental":119},"Relationships","\u002Flaravel-json-api\u002Fresources\u002Frelationships","laravel-json-api\u002F2.resources\u002F4.relationships",{"title":158,"path":159,"stem":160,"since":118,"experimental":119},"Links & meta","\u002Flaravel-json-api\u002Fresources\u002Flinks-and-meta","laravel-json-api\u002F2.resources\u002F5.links-and-meta",{"title":162,"path":163,"stem":164,"since":118,"experimental":119},"Collections & pagination","\u002Flaravel-json-api\u002Fresources\u002Fcollections","laravel-json-api\u002F2.resources\u002F6.collections",{"title":166,"since":118,"experimental":119,"icon":167,"path":168,"stem":169,"children":170,"page":119},"Requests","i-lucide-arrow-down-up","\u002Flaravel-json-api\u002Frequests","laravel-json-api\u002F3.requests",[171,175,179,183],{"title":172,"path":173,"stem":174,"since":118,"experimental":119},"Includes & sparse fieldsets","\u002Flaravel-json-api\u002Frequests\u002Fincludes-and-fieldsets","laravel-json-api\u002F3.requests\u002F1.includes-and-fieldsets",{"title":176,"path":177,"stem":178,"since":118,"experimental":119},"Validating requests","\u002Flaravel-json-api\u002Frequests\u002Fvalidation","laravel-json-api\u002F3.requests\u002F2.validation",{"title":180,"path":181,"stem":182,"since":118,"experimental":119},"Write requests","\u002Flaravel-json-api\u002Frequests\u002Fwrite-requests","laravel-json-api\u002F3.requests\u002F3.write-requests",{"title":184,"path":185,"stem":186,"since":118,"experimental":119},"Errors & content negotiation","\u002Flaravel-json-api\u002Frequests\u002Ferrors","laravel-json-api\u002F3.requests\u002F4.errors",{"title":188,"since":118,"experimental":119,"icon":50,"path":189,"stem":190,"children":191,"page":119},"API revisions","\u002Flaravel-json-api\u002Frevisions","laravel-json-api\u002F4.revisions",[192,196,200,204,208,212],{"title":193,"path":194,"stem":195,"since":118,"experimental":119},"Overview & declaring revisions","\u002Flaravel-json-api\u002Frevisions\u002Foverview","laravel-json-api\u002F4.revisions\u002F1.overview",{"title":197,"path":198,"stem":199,"since":118,"experimental":119},"Changing a field","\u002Flaravel-json-api\u002Frevisions\u002Fchanging-a-field","laravel-json-api\u002F4.revisions\u002F2.changing-a-field",{"title":201,"path":202,"stem":203,"since":118,"experimental":119},"Adding, removing, new types","\u002Flaravel-json-api\u002Frevisions\u002Fadding-and-removing","laravel-json-api\u002F4.revisions\u002F3.adding-and-removing",{"title":205,"path":206,"stem":207,"since":118,"experimental":119},"Guards","\u002Flaravel-json-api\u002Frevisions\u002Fguards","laravel-json-api\u002F4.revisions\u002F4.guards",{"title":209,"path":210,"stem":211,"since":118,"experimental":119},"Write requests across revisions","\u002Flaravel-json-api\u002Frevisions\u002Fwrite-requests","laravel-json-api\u002F4.revisions\u002F5.write-requests",{"title":213,"path":214,"stem":215,"since":118,"experimental":119},"Checking & retiring a revision","\u002Flaravel-json-api\u002Frevisions\u002Fchecking-and-retiring","laravel-json-api\u002F4.revisions\u002F6.checking-and-retiring",{"title":217,"since":118,"experimental":119,"icon":218,"path":219,"stem":220,"children":221,"page":119},"Tooling","i-lucide-wrench","\u002Flaravel-json-api\u002Ftooling","laravel-json-api\u002F5.tooling",[222,226,230],{"title":223,"path":224,"stem":225,"since":118,"experimental":119},"Checking resources","\u002Flaravel-json-api\u002Ftooling\u002Fchecking-resources","laravel-json-api\u002F5.tooling\u002F1.checking-resources",{"title":227,"path":228,"stem":229,"since":118,"experimental":119},"Static analysis","\u002Flaravel-json-api\u002Ftooling\u002Fstatic-analysis","laravel-json-api\u002F5.tooling\u002F2.static-analysis",{"title":231,"path":232,"stem":233,"since":118,"experimental":119},"Deployment","\u002Flaravel-json-api\u002Ftooling\u002Fdeployment","laravel-json-api\u002F5.tooling\u002F3.deployment",{"title":235,"since":118,"experimental":119,"icon":236,"path":237,"stem":238,"children":239,"page":119},"Integrations","i-lucide-plug","\u002Flaravel-json-api\u002Fintegrations","laravel-json-api\u002F6.integrations",[240,244],{"title":241,"path":242,"stem":243,"since":118,"experimental":119},"Laravel's native JSON:API","\u002Flaravel-json-api\u002Fintegrations\u002Fnative-json-api","laravel-json-api\u002F6.integrations\u002F1.native-json-api",{"title":245,"path":246,"stem":247,"since":118,"experimental":119},"OpenAPI","\u002Flaravel-json-api\u002Fintegrations\u002Fopenapi","laravel-json-api\u002F6.integrations\u002F2.openapi",{"title":249,"since":118,"experimental":119,"icon":250,"path":251,"stem":252,"children":253,"page":119},"Reference","i-lucide-library","\u002Flaravel-json-api\u002Freference","laravel-json-api\u002F7.reference",[254,258,262,266,270,274,278],{"title":255,"path":256,"stem":257,"since":118,"experimental":119},"Configuration","\u002Flaravel-json-api\u002Freference\u002Fconfiguration","laravel-json-api\u002F7.reference\u002F1.configuration",{"title":259,"path":260,"stem":261,"since":118,"experimental":119},"Value helpers","\u002Flaravel-json-api\u002Freference\u002Fvalue-helpers","laravel-json-api\u002F7.reference\u002F2.value-helpers",{"title":263,"path":264,"stem":265,"since":118,"experimental":119},"Relation helpers","\u002Flaravel-json-api\u002Freference\u002Frelation-helpers","laravel-json-api\u002F7.reference\u002F3.relation-helpers",{"title":267,"path":268,"stem":269,"since":118,"experimental":119},"PHP attributes","\u002Flaravel-json-api\u002Freference\u002Fphp-attributes","laravel-json-api\u002F7.reference\u002F4.php-attributes",{"title":271,"path":272,"stem":273,"since":118,"experimental":119},"Commands","\u002Flaravel-json-api\u002Freference\u002Fcommands","laravel-json-api\u002F7.reference\u002F5.commands",{"title":275,"path":276,"stem":277,"since":118,"experimental":119},"Diagnostics","\u002Flaravel-json-api\u002Freference\u002Fdiagnostics","laravel-json-api\u002F7.reference\u002F6.diagnostics",{"title":279,"path":280,"stem":281,"since":118,"experimental":119},"Extension points","\u002Flaravel-json-api\u002Freference\u002Fextension-points","laravel-json-api\u002F7.reference\u002F7.extension-points",{"title":283,"path":284,"children":285},"Releases","\u002Flaravel-json-api\u002Freleases",[286,290],{"title":287,"path":288,"stem":289,"since":118,"experimental":119},"Upgrade guide","\u002Flaravel-json-api\u002Fupgrade","laravel-json-api\u002FUPGRADE",{"title":291,"path":292,"stem":293,"since":118,"experimental":119},"Changelog","\u002Flaravel-json-api\u002Fchangelog","laravel-json-api\u002FCHANGELOG",{"id":295,"title":142,"body":296,"description":1562,"experimental":119,"extension":1563,"links":118,"meta":1564,"navigation":555,"path":143,"rawbody":1565,"seo":1566,"since":118,"stem":144,"__hash__":1567},"laravel_json_api\u002Flaravel-json-api\u002F2.resources\u002F1.anatomy.md",{"type":297,"value":298,"toc":1555},"minimark",[299,320,325,328,487,935,939,964,989,1134,1149,1153,1175,1209,1231,1245,1249,1302,1311,1383,1397,1460,1472,1476,1498,1545,1551],[300,301,302,303,307,308,311,312,315,316,319],"p",{},"A resource extends ",[304,305,306],"code",{},"Ark4ne\\JsonApi\\Resources\\JsonApiResource",". It is still a Laravel ",[304,309,310],{},"JsonResource",": return it from a\ncontroller, call ",[304,313,314],{},"make()"," or ",[304,317,318],{},"collection()"," as usual.",[321,322,324],"h2",{"id":323},"the-hooks","The hooks",[300,326,327],{},"Every hook is optional.",[329,330,331,347],"table",{},[332,333,334],"thead",{},[335,336,337,341,344],"tr",{},[338,339,340],"th",{},"Hook",[338,342,343],{},"Renders",[338,345,346],{},"Default",[348,349,350,372,395,420,435,458,472],"tbody",{},[335,351,352,358,363],{},[353,354,355],"td",{},[304,356,357],{},"toType()",[353,359,360],{},[304,361,362],{},"type",[353,364,365,368,369],{},[304,366,367],{},"#[JsonApiType]",", otherwise the class name through ",[304,370,371],{},"type.naming",[335,373,374,379,385],{},[353,375,376],{},[304,377,378],{},"toIdentifier()",[353,380,381,384],{},[304,382,383],{},"id",", as a string",[353,386,387,390,391,394],{},[304,388,389],{},"toId()"," when not ",[304,392,393],{},"null",", otherwise the model key",[335,396,397,402,407],{},[353,398,399],{},[304,400,401],{},"toAttributes()",[353,403,404],{},[304,405,406],{},"attributes",[353,408,409,410,413,414,416,417,419],{},"The model's ",[304,411,412],{},"attributesToArray()",", without its key, ",[304,415,383],{},", ",[304,418,362],{}," and the foreign keys of the declared relationships",[335,421,422,427,432],{},[353,423,424],{},[304,425,426],{},"toRelationships()",[353,428,429],{},[304,430,431],{},"relationships",[353,433,434],{},"none",[335,436,437,442,448],{},[353,438,439],{},[304,440,441],{},"toLinks()",[353,443,444,447],{},[304,445,446],{},"links"," of the resource object",[353,449,450,451],{},"none, or those of ",[452,453,455],"a",{"href":454},"\u002Flaravel-json-api\u002Fresources\u002Flinks-and-meta#links-by-route",[304,456,457],{},"#[JsonApiRoutes]",[335,459,460,465,470],{},[353,461,462],{},[304,463,464],{},"toResourceMeta()",[353,466,467,447],{},[304,468,469],{},"meta",[353,471,434],{},[335,473,474,479,485],{},[353,475,476],{},[304,477,478],{},"toDocumentMeta()",[353,480,481,482,484],{},"top-level ",[304,483,469],{},", from the primary resources only",[353,486,434],{},[488,489,495],"pre",{"className":490,"code":491,"filename":492,"language":493,"meta":494,"style":494},"language-php shiki shiki-themes material-theme-lighter github-light github-dark","use Ark4ne\\JsonApi\\Resources\\JsonApiResource;\nuse Illuminate\\Http\\Request;\n\n\u002F**\n * @extends JsonApiResource\u003CUser>\n *\u002F\nfinal class UserResource extends JsonApiResource\n{\n    public function toAttributes(Request $request): iterable\n    {\n        return [\n            'name' => $this->string(),\n            'email' => $this->string(),\n        ];\n    }\n\n    protected function toResourceMeta(Request $request): ?iterable\n    {\n        return [\n            'created_at' => $this->datetime(),\n            'updated_at' => $this->datetime(),\n        ];\n    }\n\n    protected function toRelationships(Request $request): iterable\n    {\n        return [\n            'posts' => $this->many(PostResource::class),\n            'comments' => $this->many(CommentResource::class)->whenLoaded(),\n        ];\n    }\n}\n","app\u002FHttp\u002FResources\u002FUserResource.php","php","",[304,496,497,530,550,557,564,570,576,596,602,638,643,653,682,702,708,714,719,748,753,760,780,800,805,810,815,839,844,851,884,920,924,929],{"__ignoreMap":494},[498,499,502,506,510,514,517,519,521,523,526],"span",{"class":500,"line":501},"line",1,[498,503,505],{"class":504},"sw1J6","use",[498,507,509],{"class":508},"s_hVV"," Ark4ne",[498,511,513],{"class":512},"s39Yj","\\",[498,515,516],{"class":508},"JsonApi",[498,518,513],{"class":512},[498,520,136],{"class":508},[498,522,513],{"class":512},[498,524,525],{"class":508},"JsonApiResource",[498,527,529],{"class":528},"sP7_E",";\n",[498,531,533,535,538,540,543,545,548],{"class":500,"line":532},2,[498,534,505],{"class":504},[498,536,537],{"class":508}," Illuminate",[498,539,513],{"class":512},[498,541,542],{"class":508},"Http",[498,544,513],{"class":512},[498,546,547],{"class":508},"Request",[498,549,529],{"class":528},[498,551,553],{"class":500,"line":552},3,[498,554,556],{"emptyLinePlaceholder":555},true,"\n",[498,558,560],{"class":500,"line":559},4,[498,561,563],{"class":562},"sutJx","\u002F**\n",[498,565,567],{"class":500,"line":566},5,[498,568,569],{"class":562}," * @extends JsonApiResource\u003CUser>\n",[498,571,573],{"class":500,"line":572},6,[498,574,575],{"class":562}," *\u002F\n",[498,577,579,583,586,590,593],{"class":500,"line":578},7,[498,580,582],{"class":581},"sbsja","final",[498,584,585],{"class":581}," class",[498,587,589],{"class":588},"sbgvK"," UserResource",[498,591,592],{"class":581}," extends",[498,594,595],{"class":588}," JsonApiResource\n",[498,597,599],{"class":500,"line":598},8,[498,600,601],{"class":528},"{\n",[498,603,605,608,611,615,618,621,624,628,631,635],{"class":500,"line":604},9,[498,606,607],{"class":581},"    public",[498,609,610],{"class":581}," function",[498,612,614],{"class":613},"sGLFI"," toAttributes",[498,616,617],{"class":528},"(",[498,619,547],{"class":620},"sZMiF",[498,622,623],{"class":528}," $",[498,625,627],{"class":626},"su5hD","request",[498,629,630],{"class":528},")",[498,632,634],{"class":633},"smGrS",":",[498,636,637],{"class":504}," iterable\n",[498,639,640],{"class":500,"line":29},[498,641,642],{"class":528},"    {\n",[498,644,646,650],{"class":500,"line":645},11,[498,647,649],{"class":648},"sVHd0","        return",[498,651,652],{"class":528}," [\n",[498,654,656,660,664,667,670,673,676,679],{"class":500,"line":655},12,[498,657,659],{"class":658},"sjJ54","            '",[498,661,663],{"class":662},"s_sjI","name",[498,665,666],{"class":658},"'",[498,668,669],{"class":633}," =>",[498,671,672],{"class":512}," $this",[498,674,675],{"class":633},"->",[498,677,678],{"class":613},"string",[498,680,681],{"class":528},"(),\n",[498,683,685,687,690,692,694,696,698,700],{"class":500,"line":684},13,[498,686,659],{"class":658},[498,688,689],{"class":662},"email",[498,691,666],{"class":658},[498,693,669],{"class":633},[498,695,672],{"class":512},[498,697,675],{"class":633},[498,699,678],{"class":613},[498,701,681],{"class":528},[498,703,705],{"class":500,"line":704},14,[498,706,707],{"class":528},"        ];\n",[498,709,711],{"class":500,"line":710},15,[498,712,713],{"class":528},"    }\n",[498,715,717],{"class":500,"line":716},16,[498,718,556],{"emptyLinePlaceholder":555},[498,720,722,725,727,730,732,734,736,738,740,742,745],{"class":500,"line":721},17,[498,723,724],{"class":581},"    protected",[498,726,610],{"class":581},[498,728,729],{"class":613}," toResourceMeta",[498,731,617],{"class":528},[498,733,547],{"class":620},[498,735,623],{"class":528},[498,737,627],{"class":626},[498,739,630],{"class":528},[498,741,634],{"class":633},[498,743,744],{"class":633}," ?",[498,746,747],{"class":504},"iterable\n",[498,749,751],{"class":500,"line":750},18,[498,752,642],{"class":528},[498,754,756,758],{"class":500,"line":755},19,[498,757,649],{"class":648},[498,759,652],{"class":528},[498,761,762,764,767,769,771,773,775,778],{"class":500,"line":58},[498,763,659],{"class":658},[498,765,766],{"class":662},"created_at",[498,768,666],{"class":658},[498,770,669],{"class":633},[498,772,672],{"class":512},[498,774,675],{"class":633},[498,776,777],{"class":613},"datetime",[498,779,681],{"class":528},[498,781,783,785,788,790,792,794,796,798],{"class":500,"line":782},21,[498,784,659],{"class":658},[498,786,787],{"class":662},"updated_at",[498,789,666],{"class":658},[498,791,669],{"class":633},[498,793,672],{"class":512},[498,795,675],{"class":633},[498,797,777],{"class":613},[498,799,681],{"class":528},[498,801,803],{"class":500,"line":802},22,[498,804,707],{"class":528},[498,806,808],{"class":500,"line":807},23,[498,809,713],{"class":528},[498,811,813],{"class":500,"line":812},24,[498,814,556],{"emptyLinePlaceholder":555},[498,816,818,820,822,825,827,829,831,833,835,837],{"class":500,"line":817},25,[498,819,724],{"class":581},[498,821,610],{"class":581},[498,823,824],{"class":613}," toRelationships",[498,826,617],{"class":528},[498,828,547],{"class":620},[498,830,623],{"class":528},[498,832,627],{"class":626},[498,834,630],{"class":528},[498,836,634],{"class":633},[498,838,637],{"class":504},[498,840,842],{"class":500,"line":841},26,[498,843,642],{"class":528},[498,845,847,849],{"class":500,"line":846},27,[498,848,649],{"class":648},[498,850,652],{"class":528},[498,852,854,856,859,861,863,865,867,870,872,875,878,881],{"class":500,"line":853},28,[498,855,659],{"class":658},[498,857,858],{"class":662},"posts",[498,860,666],{"class":658},[498,862,669],{"class":633},[498,864,672],{"class":512},[498,866,675],{"class":633},[498,868,869],{"class":613},"many",[498,871,617],{"class":528},[498,873,874],{"class":620},"PostResource",[498,876,877],{"class":633},"::",[498,879,880],{"class":504},"class",[498,882,883],{"class":528},"),\n",[498,885,887,889,892,894,896,898,900,902,904,907,909,911,913,915,918],{"class":500,"line":886},29,[498,888,659],{"class":658},[498,890,891],{"class":662},"comments",[498,893,666],{"class":658},[498,895,669],{"class":633},[498,897,672],{"class":512},[498,899,675],{"class":633},[498,901,869],{"class":613},[498,903,617],{"class":528},[498,905,906],{"class":620},"CommentResource",[498,908,877],{"class":633},[498,910,880],{"class":504},[498,912,630],{"class":528},[498,914,675],{"class":633},[498,916,917],{"class":613},"whenLoaded",[498,919,681],{"class":528},[498,921,922],{"class":500,"line":84},[498,923,707],{"class":528},[498,925,927],{"class":500,"line":926},31,[498,928,713],{"class":528},[498,930,932],{"class":500,"line":931},32,[498,933,934],{"class":528},"}\n",[321,936,938],{"id":937},"describe-do-not-compute","Describe, do not compute",[300,940,941,416,943,416,945,947,948,950,951,955,956,959,960,963],{},[304,942,401],{},[304,944,426],{},[304,946,464],{}," and ",[304,949,478],{}," run ",[952,953,954],"strong",{},"once per response",", on a\ntemplate whose ",[304,957,958],{},"$this->resource"," is set to each model before its values are read. So every member is ",[952,961,962],{},"declared",",\nunder its name:",[965,966,967,982],"ul",{},[968,969,970,971,974,975,416,978,981],"li",{},"a ",[952,972,973],{},"descriptor",": ",[304,976,977],{},"$this->string()",[304,979,980],{},"$this->one(UserResource::class)","…, typed and read only when the member is\nrequested;",[968,983,984,985,988],{},"or a ",[952,986,987],{},"closure",": a value of any type, computed for each resource.",[488,990,992],{"className":490,"code":991,"language":493,"meta":494,"style":494},"return [\n    \u002F\u002F read from `name`\n    'name' => $this->string(),\n    \u002F\u002F read from another key\n    'mail' => $this->string('email'),\n    \u002F\u002F any value, per resource\n    'hash' => fn() => base64_encode($this->resource->email),\n    \u002F\u002F refused: the same for every resource\n    'name' => $this->resource->name,\n];\n",[304,993,994,1001,1006,1025,1030,1057,1062,1101,1106,1129],{"__ignoreMap":494},[498,995,996,999],{"class":500,"line":501},[498,997,998],{"class":648},"return",[498,1000,652],{"class":528},[498,1002,1003],{"class":500,"line":532},[498,1004,1005],{"class":562},"    \u002F\u002F read from `name`\n",[498,1007,1008,1011,1013,1015,1017,1019,1021,1023],{"class":500,"line":552},[498,1009,1010],{"class":658},"    '",[498,1012,663],{"class":662},[498,1014,666],{"class":658},[498,1016,669],{"class":633},[498,1018,672],{"class":512},[498,1020,675],{"class":633},[498,1022,678],{"class":613},[498,1024,681],{"class":528},[498,1026,1027],{"class":500,"line":559},[498,1028,1029],{"class":562},"    \u002F\u002F read from another key\n",[498,1031,1032,1034,1037,1039,1041,1043,1045,1047,1049,1051,1053,1055],{"class":500,"line":566},[498,1033,1010],{"class":658},[498,1035,1036],{"class":662},"mail",[498,1038,666],{"class":658},[498,1040,669],{"class":633},[498,1042,672],{"class":512},[498,1044,675],{"class":633},[498,1046,678],{"class":613},[498,1048,617],{"class":528},[498,1050,666],{"class":658},[498,1052,689],{"class":662},[498,1054,666],{"class":658},[498,1056,883],{"class":528},[498,1058,1059],{"class":500,"line":572},[498,1060,1061],{"class":562},"    \u002F\u002F any value, per resource\n",[498,1063,1064,1066,1069,1071,1073,1076,1079,1081,1085,1087,1090,1092,1095,1097,1099],{"class":500,"line":578},[498,1065,1010],{"class":658},[498,1067,1068],{"class":662},"hash",[498,1070,666],{"class":658},[498,1072,669],{"class":633},[498,1074,1075],{"class":581}," fn",[498,1077,1078],{"class":528},"()",[498,1080,669],{"class":528},[498,1082,1084],{"class":1083},"sptTA"," base64_encode",[498,1086,617],{"class":528},[498,1088,1089],{"class":512},"$this",[498,1091,675],{"class":633},[498,1093,1094],{"class":626},"resource",[498,1096,675],{"class":633},[498,1098,689],{"class":626},[498,1100,883],{"class":528},[498,1102,1103],{"class":500,"line":598},[498,1104,1105],{"class":562},"    \u002F\u002F refused: the same for every resource\n",[498,1107,1108,1110,1112,1114,1116,1118,1120,1122,1124,1126],{"class":500,"line":604},[498,1109,1010],{"class":658},[498,1111,663],{"class":662},[498,1113,666],{"class":658},[498,1115,669],{"class":633},[498,1117,672],{"class":512},[498,1119,675],{"class":633},[498,1121,1094],{"class":626},[498,1123,675],{"class":633},[498,1125,663],{"class":626},[498,1127,1128],{"class":528},",\n",[498,1130,1131],{"class":500,"line":29},[498,1132,1133],{"class":528},"];\n",[300,1135,1136,1137,1140,1141,1144,1145,1148],{},"A plain value, a member without name, and Laravel's ",[304,1138,1139],{},"$this->when()"," \u002F ",[304,1142,1143],{},"$this->mergeWhen()"," are refused with a\n",[304,1146,1147],{},"DefinitionException",".",[321,1150,1152],{"id":1151},"the-definition","The definition",[300,1154,1155,1156,1159,1160,1163,1164,947,1167,1170,1171,1174],{},"The package reads what a resource declares (type, attributes, relationships, eager-loads) ",[952,1157,1158],{},"once per class",", without\na model: it runs the hooks on a probe standing for the model, with an empty request. This ",[952,1161,1162],{},"definition"," validates\n",[304,1165,1166],{},"include",[304,1168,1169],{},"fields",", plans the eager-loads, and is returned by ",[304,1172,1173],{},"UserResource::definition()",". Hence:",[1176,1177,1178],"warning",{},[300,1179,1180,1187,1188,1190,1191,947,1193,1195,1196,416,1199,1202,1203,1206,1207,1148],{},[952,1181,1182,1183,1186],{},"No ",[304,1184,1185],{},"if"," on the request or the model in a hook."," The definition sees an empty request: a member added under an ",[304,1189,1185],{},"\nis missing from it, so ",[304,1192,1169],{},[304,1194,1166],{}," cannot name it. Write conditions with ",[304,1197,1198],{},"->when()",[304,1200,1201],{},"->unless()"," or\n",[304,1204,1205],{},"$this->applyWhen()",", see ",[452,1208,150],{"href":151},[965,1210,1211,1218,1221],{},[968,1212,1213,947,1215,1217],{},[304,1214,383],{},[304,1216,362],{}," are reserved: never declare them as attributes.",[968,1219,1220],{},"Descriptors are immutable: every modifier returns a copy, so chain them or keep the returned value.",[968,1222,1223,1226,1227,1230],{},[304,1224,1225],{},"toArray()"," is the resource object alone: ",[304,1228,1229],{},"included",", document meta and pagination exist only in the response.",[300,1232,1233,1236,1237,1240,1241,1244],{},[304,1234,1235],{},"php artisan jsonapi:check"," reports what breaks these rules, and ",[304,1238,1239],{},"php artisan jsonapi:cache"," (run by ",[304,1242,1243],{},"optimize",")\ncompiles every definition for production.",[321,1246,1248],{"id":1247},"type-and-identifier","Type and identifier",[488,1250,1252],{"className":490,"code":1251,"language":493,"meta":494,"style":494},"protected function toType(Request $request): string\n{\n    return 'user';\n}\n",[304,1253,1254,1279,1283,1298],{"__ignoreMap":494},[498,1255,1256,1259,1261,1264,1266,1268,1270,1272,1274,1276],{"class":500,"line":501},[498,1257,1258],{"class":581},"protected",[498,1260,610],{"class":581},[498,1262,1263],{"class":613}," toType",[498,1265,617],{"class":528},[498,1267,547],{"class":620},[498,1269,623],{"class":528},[498,1271,627],{"class":626},[498,1273,630],{"class":528},[498,1275,634],{"class":633},[498,1277,1278],{"class":504}," string\n",[498,1280,1281],{"class":500,"line":532},[498,1282,601],{"class":528},[498,1284,1285,1288,1291,1294,1296],{"class":500,"line":552},[498,1286,1287],{"class":648},"    return",[498,1289,1290],{"class":658}," '",[498,1292,1293],{"class":662},"user",[498,1295,666],{"class":658},[498,1297,529],{"class":528},[498,1299,1300],{"class":500,"line":559},[498,1301,934],{"class":528},[300,1303,1304,1305,1307,1308,1310],{},"Without ",[304,1306,357],{},", the type is that of the ",[304,1309,367],{}," attribute:",[488,1312,1314],{"className":490,"code":1313,"language":493,"meta":494,"style":494},"use Ark4ne\\JsonApi\\Resources\\Attributes\\JsonApiType;\n\n#[JsonApiType('posts')]\nfinal class PostResource extends JsonApiResource {}\n",[304,1315,1316,1342,1346,1366],{"__ignoreMap":494},[498,1317,1318,1320,1322,1324,1326,1328,1330,1332,1335,1337,1340],{"class":500,"line":501},[498,1319,505],{"class":504},[498,1321,509],{"class":508},[498,1323,513],{"class":512},[498,1325,516],{"class":508},[498,1327,513],{"class":512},[498,1329,136],{"class":508},[498,1331,513],{"class":512},[498,1333,1334],{"class":508},"Attributes",[498,1336,513],{"class":512},[498,1338,1339],{"class":508},"JsonApiType",[498,1341,529],{"class":528},[498,1343,1344],{"class":500,"line":532},[498,1345,556],{"emptyLinePlaceholder":555},[498,1347,1348,1351,1353,1355,1357,1359,1361,1363],{"class":500,"line":552},[498,1349,1350],{"class":626},"#[",[498,1352,1339],{"class":508},[498,1354,617],{"class":528},[498,1356,666],{"class":658},[498,1358,858],{"class":662},[498,1360,666],{"class":658},[498,1362,630],{"class":528},[498,1364,1365],{"class":626},"]\n",[498,1367,1368,1370,1372,1375,1377,1380],{"class":500,"line":559},[498,1369,582],{"class":581},[498,1371,585],{"class":581},[498,1373,1374],{"class":588}," PostResource",[498,1376,592],{"class":581},[498,1378,1379],{"class":588}," JsonApiResource",[498,1381,1382],{"class":528}," {}\n",[300,1384,1385,1386,1388,1389,1392,1393,1396],{},"Otherwise it follows ",[304,1387,371],{},", from the class name without its ",[304,1390,1391],{},"Resource"," suffix (",[304,1394,1395],{},"BlogPostResource","):",[329,1398,1399,1410],{},[332,1400,1401],{},[335,1402,1403,1407],{},[338,1404,1405],{},[304,1406,371],{},[338,1408,1409],{},"Type",[348,1411,1412,1425,1437,1449],{},[335,1413,1414,1420],{},[353,1415,1416,1419],{},[304,1417,1418],{},"kebab-singular"," (default)",[353,1421,1422],{},[304,1423,1424],{},"blog-post",[335,1426,1427,1432],{},[353,1428,1429],{},[304,1430,1431],{},"kebab-plural",[353,1433,1434],{},[304,1435,1436],{},"blog-posts",[335,1438,1439,1444],{},[353,1440,1441],{},[304,1442,1443],{},"snake-plural",[353,1445,1446],{},[304,1447,1448],{},"blog_posts",[335,1450,1451,1457],{},[353,1452,1453,1454],{},"a class implementing ",[304,1455,1456],{},"Ark4ne\\JsonApi\\Configuration\\TypeNaming",[353,1458,1459],{},"its own",[300,1461,1462,1463,1465,1466,1468,1469,1471],{},"The identifier is ",[304,1464,389],{}," when it gives one (the hook of Laravel's native resources, ",[304,1467,393],{}," by default), otherwise\nthe model key. Override ",[304,1470,378],{}," for anything else; it is always rendered as a string.",[321,1473,1475],{"id":1474},"generating-a-resource","Generating a resource",[300,1477,1478,1481,1482,1485,1486,1489,1490,1493,1494,1497],{},[304,1479,1480],{},"php artisan make:jsonapi-resource PostResource"," writes ",[304,1483,1484],{},"app\u002FHttp\u002FResources\u002FPostResource.php"," from the model\n(",[304,1487,1488],{},"--model=Post",", otherwise ",[304,1491,1492],{},"App\\Models\\Post"," by convention; ",[304,1495,1496],{},"--force"," overwrites):",[965,1499,1500,1534],{},[968,1501,1502,1503,1506,1507,1128,1510,1506,1513,1516,1517,1520,1521,1524,1525,416,1527,1529,1530,1533],{},"the attributes from the casts (",[304,1504,1505],{},"'datetime:Y-m-d H:i'"," gives ",[304,1508,1509],{},"$this->datetime()->format('Y-m-d H:i')",[304,1511,1512],{},"'decimal:2'",[304,1514,1515],{},"$this->decimal()->scale(2)",", an enum gives ",[304,1518,1519],{},"$this->enum()","), then the fillable attributes\nwithout cast (",[304,1522,1523],{},"$this->mixed()",") and the timestamps; never the key, ",[304,1526,383],{},[304,1528,362],{},", the hidden attributes nor the\nforeign keys of the ",[304,1531,1532],{},"BelongsTo"," relations;",[968,1535,1536,1537,1540,1541,1544],{},"the relationships from the public methods typed with a relation (",[304,1538,1539],{},"'user' => $this->one()","); a ",[304,1542,1543],{},"MorphTo"," is left as\na comment, to complete with its resources.",[300,1546,1547,1550],{},[304,1548,1549],{},"php artisan vendor:publish --tag=jsonapi-stubs"," publishes the stub to customise it.",[1552,1553,1554],"style",{},"html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s_hVV, html code.shiki .s_hVV{--shiki-light:#90A4AE;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .s39Yj, html code.shiki .s39Yj{--shiki-light:#39ADB5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":494,"searchDepth":552,"depth":552,"links":1556},[1557,1558,1559,1560,1561],{"id":323,"depth":532,"text":324},{"id":937,"depth":532,"text":938},{"id":1151,"depth":532,"text":1152},{"id":1247,"depth":532,"text":1248},{"id":1474,"depth":532,"text":1475},"The hooks of a resource, and why they describe values instead of computing them.","md",{},"---\ntitle: Anatomy of a resource\ndescription: The hooks of a resource, and why they describe values instead of computing them.\n---\n\nA resource extends `Ark4ne\\JsonApi\\Resources\\JsonApiResource`. It is still a Laravel `JsonResource`: return it from a\ncontroller, call `make()` or `collection()` as usual.\n\n## The hooks\n\nEvery hook is optional.\n\n| Hook | Renders | Default |\n| --- | --- | --- |\n| `toType()` | `type` | `#[JsonApiType]`, otherwise the class name through `type.naming` |\n| `toIdentifier()` | `id`, as a string | `toId()` when not `null`, otherwise the model key |\n| `toAttributes()` | `attributes` | The model's `attributesToArray()`, without its key, `id`, `type` and the foreign keys of the declared relationships |\n| `toRelationships()` | `relationships` | none |\n| `toLinks()` | `links` of the resource object | none, or those of [`#[JsonApiRoutes]`](\u002Flaravel-json-api\u002Fresources\u002Flinks-and-meta#links-by-route) |\n| `toResourceMeta()` | `meta` of the resource object | none |\n| `toDocumentMeta()` | top-level `meta`, from the primary resources only | none |\n\n```php [app\u002FHttp\u002FResources\u002FUserResource.php]\nuse Ark4ne\\JsonApi\\Resources\\JsonApiResource;\nuse Illuminate\\Http\\Request;\n\n\u002F**\n * @extends JsonApiResource\u003CUser>\n *\u002F\nfinal class UserResource extends JsonApiResource\n{\n    public function toAttributes(Request $request): iterable\n    {\n        return [\n            'name' => $this->string(),\n            'email' => $this->string(),\n        ];\n    }\n\n    protected function toResourceMeta(Request $request): ?iterable\n    {\n        return [\n            'created_at' => $this->datetime(),\n            'updated_at' => $this->datetime(),\n        ];\n    }\n\n    protected function toRelationships(Request $request): iterable\n    {\n        return [\n            'posts' => $this->many(PostResource::class),\n            'comments' => $this->many(CommentResource::class)->whenLoaded(),\n        ];\n    }\n}\n```\n\n## Describe, do not compute\n\n`toAttributes()`, `toRelationships()`, `toResourceMeta()` and `toDocumentMeta()` run **once per response**, on a\ntemplate whose `$this->resource` is set to each model before its values are read. So every member is **declared**,\nunder its name:\n\n- a **descriptor**: `$this->string()`, `$this->one(UserResource::class)`…, typed and read only when the member is\n  requested;\n- or a **closure**: a value of any type, computed for each resource.\n\n```php\nreturn [\n    \u002F\u002F read from `name`\n    'name' => $this->string(),\n    \u002F\u002F read from another key\n    'mail' => $this->string('email'),\n    \u002F\u002F any value, per resource\n    'hash' => fn() => base64_encode($this->resource->email),\n    \u002F\u002F refused: the same for every resource\n    'name' => $this->resource->name,\n];\n```\n\nA plain value, a member without name, and Laravel's `$this->when()` \u002F `$this->mergeWhen()` are refused with a\n`DefinitionException`.\n\n## The definition\n\nThe package reads what a resource declares (type, attributes, relationships, eager-loads) **once per class**, without\na model: it runs the hooks on a probe standing for the model, with an empty request. This **definition** validates\n`include` and `fields`, plans the eager-loads, and is returned by `UserResource::definition()`. Hence:\n\n::warning\n**No `if` on the request or the model in a hook.** The definition sees an empty request: a member added under an `if`\nis missing from it, so `fields` and `include` cannot name it. Write conditions with `->when()`, `->unless()` or\n`$this->applyWhen()`, see [Conditions](\u002Flaravel-json-api\u002Fresources\u002Fconditions).\n::\n\n- `id` and `type` are reserved: never declare them as attributes.\n- Descriptors are immutable: every modifier returns a copy, so chain them or keep the returned value.\n- `toArray()` is the resource object alone: `included`, document meta and pagination exist only in the response.\n\n`php artisan jsonapi:check` reports what breaks these rules, and `php artisan jsonapi:cache` (run by `optimize`)\ncompiles every definition for production.\n\n## Type and identifier\n\n```php\nprotected function toType(Request $request): string\n{\n    return 'user';\n}\n```\n\nWithout `toType()`, the type is that of the `#[JsonApiType]` attribute:\n\n```php\nuse Ark4ne\\JsonApi\\Resources\\Attributes\\JsonApiType;\n\n#[JsonApiType('posts')]\nfinal class PostResource extends JsonApiResource {}\n```\n\nOtherwise it follows `type.naming`, from the class name without its `Resource` suffix (`BlogPostResource`):\n\n| `type.naming` | Type |\n| --- | --- |\n| `kebab-singular` (default) | `blog-post` |\n| `kebab-plural` | `blog-posts` |\n| `snake-plural` | `blog_posts` |\n| a class implementing `Ark4ne\\JsonApi\\Configuration\\TypeNaming` | its own |\n\nThe identifier is `toId()` when it gives one (the hook of Laravel's native resources, `null` by default), otherwise\nthe model key. Override `toIdentifier()` for anything else; it is always rendered as a string.\n\n## Generating a resource\n\n`php artisan make:jsonapi-resource PostResource` writes `app\u002FHttp\u002FResources\u002FPostResource.php` from the model\n(`--model=Post`, otherwise `App\\Models\\Post` by convention; `--force` overwrites):\n\n- the attributes from the casts (`'datetime:Y-m-d H:i'` gives `$this->datetime()->format('Y-m-d H:i')`,\n  `'decimal:2'` gives `$this->decimal()->scale(2)`, an enum gives `$this->enum()`), then the fillable attributes\n  without cast (`$this->mixed()`) and the timestamps; never the key, `id`, `type`, the hidden attributes nor the\n  foreign keys of the `BelongsTo` relations;\n- the relationships from the public methods typed with a relation (`'user' => $this->one()`); a `MorphTo` is left as\n  a comment, to complete with its resources.\n\n`php artisan vendor:publish --tag=jsonapi-stubs` publishes the stub to customise it.\n",{"title":142,"description":1562},"ZtbwqUySz-QwG8axsWUscDO27hrW2dn6OJXp5vKFRQQ",[1569,1571],{"title":132,"path":133,"stem":134,"description":1570,"children":-1},"From a model to a compound document with includes and sparse fieldsets.",{"title":146,"path":147,"stem":148,"description":1572,"children":-1},"Typed values, lists, objects, enums, and value types of your own.",1795438901714]