[{"data":1,"prerenderedAt":1769},["ShallowReactive",2],{"navigation":3,"\u002Fgetting-started\u002Fquick-start":307,"\u002Fgetting-started\u002Fquick-start-surround":1764},{"3.x":4,"2.x":203},[5,32,61,99,121,147,165],{"title":6,"icon":7,"path":8,"stem":9,"children":10,"page":31},"Getting Started","i-heroicons-star","\u002Fgetting-started","1.getting-started",[11,15,19,23,27],{"title":12,"path":13,"stem":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":16,"path":17,"stem":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":20,"path":21,"stem":22},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",{"title":24,"path":25,"stem":26},"Configuration","\u002Fgetting-started\u002Fconfiguration","1.getting-started\u002F4.configuration",{"title":28,"path":29,"stem":30},"Upgrade guide","\u002Fgetting-started\u002Fupgrade-guide","1.getting-started\u002F5.upgrade-guide",false,{"title":33,"icon":34,"path":35,"stem":36,"children":37,"page":31},"Resources","i-heroicons-document-text","\u002Fresources","2.resources",[38,41,45,49,53,57],{"title":33,"path":39,"stem":40},"\u002Fresources\u002Fresources","2.resources\u002F1.resources",{"title":42,"path":43,"stem":44},"Fields","\u002Fresources\u002Ffields","2.resources\u002F2.fields",{"title":46,"path":47,"stem":48},"Relationships","\u002Fresources\u002Frelations","2.resources\u002F3.relations",{"title":50,"path":51,"stem":52},"Validation","\u002Fresources\u002Fvalidation","2.resources\u002F4.validation",{"title":54,"path":55,"stem":56},"Perimeter","\u002Fresources\u002Fperimeter","2.resources\u002F5.perimeter",{"title":58,"path":59,"stem":60},"Limits","\u002Fresources\u002Flimits","2.resources\u002F6.limits",{"title":62,"icon":63,"path":64,"stem":65,"children":66,"page":31},"Search","i-heroicons-magnifying-glass","\u002Fsearch","3.search",[67,71,75,79,83,87,91,95],{"title":68,"path":69,"stem":70},"Search overview","\u002Fsearch\u002Foverview","3.search\u002F1.overview",{"title":72,"path":73,"stem":74},"Search filters","\u002Fsearch\u002Ffilters","3.search\u002F2.filters",{"title":76,"path":77,"stem":78},"Sorts and selects","\u002Fsearch\u002Fsorts-and-selects","3.search\u002F3.sorts-and-selects",{"title":80,"path":81,"stem":82},"Includes and aggregates","\u002Fsearch\u002Fincludes-and-aggregates","3.search\u002F4.includes-and-aggregates",{"title":84,"path":85,"stem":86},"Scopes and instructions","\u002Fsearch\u002Fscopes-and-instructions","3.search\u002F5.scopes-and-instructions",{"title":88,"path":89,"stem":90},"Text search","\u002Fsearch\u002Ftext-search","3.search\u002F6.text-search",{"title":92,"path":93,"stem":94},"Search engines","\u002Fsearch\u002Fsearch-engines","3.search\u002F7.search-engines",{"title":96,"path":97,"stem":98},"Searching outside HTTP","\u002Fsearch\u002Foutside-http","3.search\u002F8.outside-http",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":31},"Writing","i-heroicons-pencil-square","\u002Fwriting","4.writing",[105,109,113,117],{"title":106,"path":107,"stem":108},"Mutate","\u002Fwriting\u002Fmutate","4.writing\u002F1.mutate",{"title":110,"path":111,"stem":112},"Writing relations","\u002Fwriting\u002Frelations","4.writing\u002F2.relations",{"title":114,"path":115,"stem":116},"Versioned rows","\u002Fwriting\u002Fversioned-rows","4.writing\u002F3.versioned-rows",{"title":118,"path":119,"stem":120},"Deleting and restoring","\u002Fwriting\u002Fdeleting","4.writing\u002F4.deleting",{"title":122,"icon":123,"path":124,"stem":125,"children":126,"page":31},"Actions and Metrics","i-heroicons-bolt","\u002Factions-and-metrics","5.actions-and-metrics",[127,131,135,139,143],{"title":128,"path":129,"stem":130},"Actions","\u002Factions-and-metrics\u002Factions","5.actions-and-metrics\u002F1.actions",{"title":132,"path":133,"stem":134},"Queued Actions","\u002Factions-and-metrics\u002Fqueued-actions","5.actions-and-metrics\u002F2.queued-actions",{"title":136,"path":137,"stem":138},"Confirmation","\u002Factions-and-metrics\u002Fconfirmation","5.actions-and-metrics\u002F3.confirmation",{"title":140,"path":141,"stem":142},"Metrics","\u002Factions-and-metrics\u002Fmetrics","5.actions-and-metrics\u002F4.metrics",{"title":144,"path":145,"stem":146},"Exports","\u002Factions-and-metrics\u002Fexports","5.actions-and-metrics\u002F5.exports",{"title":148,"icon":149,"path":150,"stem":151,"children":152,"page":31},"Authorization","i-heroicons-lock-closed","\u002Fauthorization","6.authorization",[153,157,161],{"title":154,"path":155,"stem":156},"Policies","\u002Fauthorization\u002Fpolicies","6.authorization\u002F1.policies",{"title":158,"path":159,"stem":160},"Gates","\u002Fauthorization\u002Fgates","6.authorization\u002F2.gates",{"title":162,"path":163,"stem":164},"Decision Cache","\u002Fauthorization\u002Fdecision-cache","6.authorization\u002F3.decision-cache",{"title":166,"icon":167,"path":168,"stem":169,"children":170,"page":31},"Digging Deeper","i-heroicons-list-bullet","\u002Fdigging-deeper","7.digging-deeper",[171,175,179,183,187,191,195,199],{"title":172,"path":173,"stem":174},"Details","\u002Fdigging-deeper\u002Fdetails","7.digging-deeper\u002F1.details",{"title":176,"path":177,"stem":178},"Events and Hooks","\u002Fdigging-deeper\u002Fevents-and-hooks","7.digging-deeper\u002F2.events-and-hooks",{"title":180,"path":181,"stem":182},"Custom Responses","\u002Fdigging-deeper\u002Fresponses","7.digging-deeper\u002F3.responses",{"title":184,"path":185,"stem":186},"OpenAPI Documentation","\u002Fdigging-deeper\u002Fopenapi","7.digging-deeper\u002F4.openapi",{"title":188,"path":189,"stem":190},"Precognition","\u002Fdigging-deeper\u002Fprecognition","7.digging-deeper\u002F5.precognition",{"title":192,"path":193,"stem":194},"Artisan Commands","\u002Fdigging-deeper\u002Fartisan","7.digging-deeper\u002F6.artisan",{"title":196,"path":197,"stem":198},"Laravel Boost Skill","\u002Fdigging-deeper\u002Fai-skill","7.digging-deeper\u002F7.ai-skill",{"title":200,"path":201,"stem":202},"Translations","\u002Fdigging-deeper\u002Ftranslations","7.digging-deeper\u002F8.translations",[204,215,237,260,297],{"title":6,"icon":7,"path":205,"stem":206,"children":207,"page":31},"\u002F2.x\u002Fgetting-started","2.x\u002F1.getting-started",[208,211],{"title":16,"path":209,"stem":210},"\u002F2.x\u002Fgetting-started\u002Finstallation","2.x\u002F1.getting-started\u002F1.installation",{"title":212,"path":213,"stem":214},"Upgrade Guide","\u002F2.x\u002Fgetting-started\u002Fupgrade-guide","2.x\u002F1.getting-started\u002F2.upgrade-guide",{"title":216,"icon":217,"path":218,"stem":219,"children":220,"page":31},"Endpoints","i-heroicons-arrow-uturn-left","\u002F2.x\u002Fendpoints","2.x\u002F2.endpoints",[221,224,227,230,233],{"title":172,"path":222,"stem":223},"\u002F2.x\u002Fendpoints\u002Fdetails","2.x\u002F2.endpoints\u002F1.details",{"title":62,"path":225,"stem":226},"\u002F2.x\u002Fendpoints\u002Fsearch","2.x\u002F2.endpoints\u002F2.search",{"title":106,"path":228,"stem":229},"\u002F2.x\u002Fendpoints\u002Fmutate","2.x\u002F2.endpoints\u002F3.mutate",{"title":128,"path":231,"stem":232},"\u002F2.x\u002Fendpoints\u002Factions","2.x\u002F2.endpoints\u002F4.actions",{"title":234,"path":235,"stem":236},"Delete","\u002F2.x\u002Fendpoints\u002Fdelete","2.x\u002F2.endpoints\u002F5.delete",{"title":33,"icon":34,"path":238,"stem":239,"children":240,"page":31},"\u002F2.x\u002Fresources","2.x\u002F3.resources",[241,245,249,252,256],{"title":242,"path":243,"stem":244},"Basics","\u002F2.x\u002Fresources\u002Fbasics","2.x\u002F3.resources\u002F1.basics",{"title":246,"path":247,"stem":248},"Exposed Data","\u002F2.x\u002Fresources\u002Fexposed-data","2.x\u002F3.resources\u002F2.exposed-data",{"title":46,"path":250,"stem":251},"\u002F2.x\u002Fresources\u002Frelationships","2.x\u002F3.resources\u002F3.relationships",{"title":253,"path":254,"stem":255},"Validations","\u002F2.x\u002Fresources\u002Fvalidations","2.x\u002F3.resources\u002F4.validations",{"title":257,"path":258,"stem":259},"Interactions","\u002F2.x\u002Fresources\u002Finteractions","2.x\u002F3.resources\u002F5.interactions",{"title":166,"icon":167,"path":261,"stem":262,"children":263,"page":31},"\u002F2.x\u002Fdigging-deeper","2.x\u002F4.digging-deeper",[264,267,271,274,278,282,286,290,294],{"title":128,"path":265,"stem":266},"\u002F2.x\u002Fdigging-deeper\u002Factions","2.x\u002F4.digging-deeper\u002F1.actions",{"title":268,"path":269,"stem":270},"Hooks","\u002F2.x\u002Fdigging-deeper\u002Fhooks","2.x\u002F4.digging-deeper\u002F2.hooks",{"title":158,"path":272,"stem":273},"\u002F2.x\u002Fdigging-deeper\u002Fgates","2.x\u002F4.digging-deeper\u002F3.gates",{"title":275,"path":276,"stem":277},"Authorizations","\u002F2.x\u002Fdigging-deeper\u002Fauthorizations","2.x\u002F4.digging-deeper\u002F4.authorizations",{"title":279,"path":280,"stem":281},"Full Text Search","\u002F2.x\u002Fdigging-deeper\u002Ffull-text-search","2.x\u002F4.digging-deeper\u002F5.full-text-search",{"title":283,"path":284,"stem":285},"Instructions","\u002F2.x\u002Fdigging-deeper\u002Finstructions","2.x\u002F4.digging-deeper\u002F6.instructions",{"title":287,"path":288,"stem":289},"Responses","\u002F2.x\u002Fdigging-deeper\u002Fresponses","2.x\u002F4.digging-deeper\u002F7.responses",{"title":291,"path":292,"stem":293},"Documentation","\u002F2.x\u002Fdigging-deeper\u002Fdocumentation","2.x\u002F4.digging-deeper\u002F8.documentation",{"title":188,"path":295,"stem":296},"\u002F2.x\u002Fdigging-deeper\u002Fprecognition","2.x\u002F4.digging-deeper\u002F9.precognition",{"title":298,"icon":299,"path":300,"stem":301,"children":302,"page":31},"Integrations","i-lucide-puzzle","\u002F2.x\u002Fintegrations","2.x\u002F5.integrations",[303],{"title":304,"path":305,"stem":306},"Flutter","\u002F2.x\u002Fintegrations\u002Fflutter","2.x\u002F5.integrations\u002F1.flutter",{"id":308,"title":20,"body":309,"description":1757,"extension":1758,"links":1759,"meta":1760,"navigation":495,"path":21,"seo":1761,"sitemap":1762,"stem":22,"__hash__":1763},"docs3x\u002F1.getting-started\u002F3.quick-start.md",{"type":310,"value":311,"toc":1746},"minimark",[312,317,321,347,358,409,424,431,554,563,568,586,612,616,627,657,677,694,709,724,728,731,765,768,776,786,789,795,799,814,820,855,859,877,899,1100,1285,1309,1314,1318,1324,1333,1502,1508,1620,1633,1706,1716,1720,1742],[313,314,316],"h2",{"id":315},"expose-your-models","Expose your models",[318,319,320],"p",{},"Run the quick start command in your application:",[322,323,328],"pre",{"className":324,"code":325,"language":326,"meta":327,"style":327},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","php artisan rest:quick-start\n","bash","",[329,330,331],"code",{"__ignoreMap":327},[332,333,336,340,344],"span",{"class":334,"line":335},"line",1,[332,337,339],{"class":338},"sBMFI","php",[332,341,343],{"class":342},"sfazB"," artisan",[332,345,346],{"class":342}," rest:quick-start\n",[318,348,349,350,353,354,357],{},"The command asks ",[329,351,352],{},"Which models should the API expose?"," and lists the models of ",[329,355,356],{},"app\u002FModels",". Pick one or more. For each model, it writes:",[359,360,361,382,391,400],"ul",{},[362,363,364,365,369,370,373,374,381],"li",{},"a ",[366,367,368],"strong",{},"resource"," in ",[329,371,372],{},"app\u002FRest\u002FResources",", with one field per column of the table and the relations to the other chosen models, as ",[375,376,378],"a",{"href":377},"\u002Fresources\u002Fresources#generating-a-resource",[329,379,380],{},"rest:resource --generate"," does;",[362,383,364,384,369,387,390],{},[366,385,386],{},"controller",[329,388,389],{},"app\u002FRest\u002FControllers",";",[362,392,364,393,369,396,399],{},[366,394,395],{},"policy",[329,397,398],{},"app\u002FPolicies"," that allows every ability to a signed-in user, when Gate finds no policy for the model;",[362,401,364,402,369,405,408],{},[366,403,404],{},"route",[329,406,407],{},"routes\u002Fapi.php",", behind the authentication middleware of the guard.",[318,410,411,412,415,416,419,420,423],{},"It also creates the base classes ",[329,413,414],{},"app\u002FRest\u002FResources\u002FResource.php"," and ",[329,417,418],{},"app\u002FRest\u002FControllers\u002FController.php"," when they are missing. An existing class is never changed: the command reports it as ",[329,421,422],{},"kept",", so a second run changes nothing.",[318,425,426,427,430],{},"For a ",[329,428,429],{},"Product"," model, the route looks like this:",[322,432,435],{"className":433,"code":434,"filename":407,"language":339,"meta":327,"style":327},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","use App\\Rest\\Controllers\\ProductsController;\nuse Lomkit\\Rest\\Facades\\Rest;\n\nRest::resource('products', ProductsController::class)\n    ->middleware('auth:sanctum');\n",[329,436,437,467,490,497,533],{"__ignoreMap":327},[332,438,439,443,447,451,454,456,459,461,464],{"class":334,"line":335},[332,440,442],{"class":441},"sbssI","use",[332,444,446],{"class":445},"sTEyZ"," App",[332,448,450],{"class":449},"sMK4o","\\",[332,452,453],{"class":445},"Rest",[332,455,450],{"class":449},[332,457,458],{"class":445},"Controllers",[332,460,450],{"class":449},[332,462,463],{"class":445},"ProductsController",[332,465,466],{"class":449},";\n",[332,468,470,472,475,477,479,481,484,486,488],{"class":334,"line":469},2,[332,471,442],{"class":441},[332,473,474],{"class":445}," Lomkit",[332,476,450],{"class":449},[332,478,453],{"class":445},[332,480,450],{"class":449},[332,482,483],{"class":445},"Facades",[332,485,450],{"class":449},[332,487,453],{"class":445},[332,489,466],{"class":449},[332,491,493],{"class":334,"line":492},3,[332,494,496],{"emptyLinePlaceholder":495},true,"\n",[332,498,500,502,505,508,511,514,517,519,522,525,527,530],{"class":334,"line":499},4,[332,501,453],{"class":338},[332,503,504],{"class":449},"::",[332,506,368],{"class":507},"s2Zo4",[332,509,510],{"class":449},"(",[332,512,513],{"class":449},"'",[332,515,516],{"class":342},"products",[332,518,513],{"class":449},[332,520,521],{"class":449},",",[332,523,524],{"class":338}," ProductsController",[332,526,504],{"class":449},[332,528,529],{"class":441},"class",[332,531,532],{"class":449},")\n",[332,534,536,539,542,544,546,549,551],{"class":334,"line":535},5,[332,537,538],{"class":449},"    ->",[332,540,541],{"class":507},"middleware",[332,543,510],{"class":449},[332,545,513],{"class":449},[332,547,548],{"class":342},"auth:sanctum",[332,550,513],{"class":449},[332,552,553],{"class":449},");\n",[555,556,557],"warning",{},[318,558,559,560,562],{},"The generated policies let every signed-in user do everything. Edit them before production. See ",[375,561,154],{"href":155},".",[564,565,567],"h3",{"id":566},"without-a-terminal","Without a terminal",[318,569,570,571,574,575,578,579,582,583,585],{},"In CI, in a script, or with ",[329,572,573],{},"--no-interaction",", name each model with ",[329,576,577],{},"--model",". The command never answers its own questions, so pass ",[329,580,581],{},"--install-api"," too when ",[329,584,407],{}," or Laravel Sanctum is missing:",[322,587,589],{"className":324,"code":588,"language":326,"meta":327,"style":327},"php artisan rest:quick-start --no-interaction --model=Product --model=Category --install-api\n",[329,590,591],{"__ignoreMap":327},[332,592,593,595,597,600,603,606,609],{"class":334,"line":335},[332,594,339],{"class":338},[332,596,343],{"class":342},[332,598,599],{"class":342}," rest:quick-start",[332,601,602],{"class":342}," --no-interaction",[332,604,605],{"class":342}," --model=Product",[332,607,608],{"class":342}," --model=Category",[332,610,611],{"class":342}," --install-api\n",[564,613,615],{"id":614},"choosing-the-guard","Choosing the guard",[318,617,618,619,622,623,626],{},"The routes use the ",[329,620,621],{},"sanctum"," guard by default. Pass ",[329,624,625],{},"--guard"," to use another one:",[359,628,629,634,648],{},[362,630,631,633],{},[329,632,621],{}," uses Laravel Sanctum.",[362,635,636,639,640,643,644,647],{},[329,637,638],{},"api"," uses Laravel Passport, when ",[329,641,642],{},"config\u002Fauth.php"," does not define it or defines it with the ",[329,645,646],{},"passport"," driver.",[362,649,650,651,653,654,562],{},"Any other guard that ",[329,652,642],{}," defines is used as it is, for example ",[329,655,656],{},"--guard=web",[322,658,660],{"className":324,"code":659,"language":326,"meta":327,"style":327},"php artisan rest:quick-start --model=Product --guard=api --install-api\n",[329,661,662],{"__ignoreMap":327},[332,663,664,666,668,670,672,675],{"class":334,"line":335},[332,665,339],{"class":338},[332,667,343],{"class":342},[332,669,599],{"class":342},[332,671,605],{"class":342},[332,673,674],{"class":342}," --guard=api",[332,676,611],{"class":342},[318,678,679,680,682,683,686,687,690,691,693],{},"When ",[329,681,407],{}," does not exist, or when the package of the guard is missing, the command asks before it runs ",[329,684,685],{},"php artisan install:api"," (Laravel Sanctum) or ",[329,688,689],{},"php artisan install:api --passport"," (Laravel Passport). ",[329,692,581],{}," runs it without asking.",[318,695,696,697,699,700,703,704,706,707,562],{},"When such an install is needed, ",[329,698,625],{}," is not passed and a terminal can answer, the command first asks ",[329,701,702],{},"Which guard should protect the API routes?",", with ",[329,705,621],{}," as the default. Without a terminal, the guard is ",[329,708,621],{},[710,711,712],"note",{},[318,713,714,715,717,718,720,721,723],{},"Laravel Passport needs an ",[329,716,638],{}," guard with the ",[329,719,646],{}," driver in ",[329,722,642],{},". The command never edits that file: add the guard yourself.",[564,725,727],{"id":726},"what-the-command-checks","What the command checks",[318,729,730],{},"Before it writes anything, the command stops with exit code 1 when:",[359,732,733,740,743,752,758],{},[362,734,735,736,739],{},"the routes of the application are cached: run ",[329,737,738],{},"php artisan route:clear"," first;",[362,741,742],{},"a model does not exist or has no table;",[362,744,745,746,415,749,390],{},"two chosen models would get the same resource name, such as ",[329,747,748],{},"App\\Models\\Note",[329,750,751],{},"App\\Models\\Archive\\Note",[362,753,754,755,390],{},"an existing route already uses the URIs or the names of the new routes, such as ",[329,756,757],{},"Route::apiResource('products', ...)",[362,759,760,761,764],{},"Gate would not find the policy that it writes, for example for a model outside the namespace of the application. Register a policy with ",[329,762,763],{},"Gate::policy()",", then run the command again.",[318,766,767],{},"After writing, it checks the result in a new PHP process: each route is behind an authentication middleware whose guard exists, and Gate finds a policy for each model.",[322,769,774],{"className":770,"code":772,"language":773,"meta":327},[771],"language-text","  checks (fresh process) ... 6 routes authenticated, 1 policy found\n","text",[329,775,772],{"__ignoreMap":327},[318,777,778,779,782,783,562],{},"It does not check the perimeters of the resources or the row checks of the actions: run ",[329,780,781],{},"php artisan rest:check"," for these, see ",[375,784,54],{"href":785},"\u002Fresources\u002Fperimeter#resources-without-a-perimeter",[318,787,788],{},"A relation to a model that you did not choose is skipped and reported, with the option to add:",[322,790,793],{"className":791,"code":792,"language":773,"meta":327},[771],"  Skipped: Post.author: no resource for App\\Models\\User. Rerun with --model=User to expose users.\n",[329,794,792],{"__ignoreMap":327},[313,796,798],{"id":797},"authenticate","Authenticate",[318,800,801,802,805,806,809,810,813],{},"The command ends with the next steps: a command that creates a token for your first user, then a ",[329,803,804],{},"curl"," request to the search route of the first model. The request goes to the ",[329,807,808],{},"app.url"," of your configuration, ",[329,811,812],{},"http:\u002F\u002Flocalhost"," when it is empty. When the command wrote policies, a reminder that they allow every ability follows. With Laravel Sanctum:",[322,815,818],{"className":816,"code":817,"language":773,"meta":327},[771],"  Next:\n    php artisan tinker --execute=\"echo App\\Models\\User::first()->createToken('cli')->plainTextToken;\"\n    curl -X POST http:\u002F\u002Flocalhost\u002Fapi\u002Fproducts\u002Fsearch -H \"Authorization: Bearer \u003Ctoken>\" -H \"Accept: application\u002Fjson\" -H \"Content-Type: application\u002Fjson\" -d '{\"search\":{\"limit\":10}}'\n  ProductPolicy lets signed-in users do everything. Edit app\u002FPolicies before production.\n",[329,819,817],{"__ignoreMap":327},[359,821,822,832,848],{},[362,823,824,825,828,829,562],{},"With Laravel Passport, the token command reads ",[329,826,827],{},"accessToken"," instead of ",[329,830,831],{},"plainTextToken",[362,833,834,835,838,839,841,842,844,845,847],{},"With another guard, the command prints ",[329,836,837],{},"Authenticate with the web guard to call the API."," (for ",[329,840,656],{},") instead of a token command, and the ",[329,843,804],{}," request has no ",[329,846,148],{}," header.",[362,849,850,851,854],{},"The user model needs the ",[329,852,853],{},"HasApiTokens"," trait of Laravel Sanctum or Laravel Passport. The command never edits the user model: it warns when the trait is missing.",[313,856,858],{"id":857},"your-first-search","Your first search",[318,860,861,862,865,866,869,870,415,873,876],{},"Assume the generated ",[329,863,864],{},"ProductResource"," declares ",[329,867,868],{},"id",", ",[329,871,872],{},"name",[329,874,875],{},"price",", and the table holds a desk lamp at 39 and a floor lamp at 129. Search the products cheaper than 100:",[322,878,882],{"className":879,"code":880,"language":881,"meta":327,"style":327},"language-http shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","POST \u002Fapi\u002Fproducts\u002Fsearch\nAuthorization: Bearer \u003Ctoken>\nAccept: application\u002Fjson\n","http",[329,883,884,889,894],{"__ignoreMap":327},[332,885,886],{"class":334,"line":335},[332,887,888],{},"POST \u002Fapi\u002Fproducts\u002Fsearch\n",[332,890,891],{"class":334,"line":469},[332,892,893],{},"Authorization: Bearer \u003Ctoken>\n",[332,895,896],{"class":334,"line":492},[332,897,898],{},"Accept: application\u002Fjson\n",[322,900,904],{"className":901,"code":902,"language":903,"meta":327,"style":327},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"search\": {\n    \"filters\": [\n      {\"field\": \"price\", \"operator\": \"\u003C\", \"value\": 100}\n    ],\n    \"selects\": [\n      {\"field\": \"id\"},\n      {\"field\": \"name\"},\n      {\"field\": \"price\"}\n    ]\n  }\n}\n","json",[329,905,906,911,929,944,1000,1005,1019,1041,1062,1083,1089,1095],{"__ignoreMap":327},[332,907,908],{"class":334,"line":335},[332,909,910],{"class":449},"{\n",[332,912,913,916,920,923,926],{"class":334,"line":469},[332,914,915],{"class":449},"  \"",[332,917,919],{"class":918},"spNyl","search",[332,921,922],{"class":449},"\"",[332,924,925],{"class":449},":",[332,927,928],{"class":449}," {\n",[332,930,931,934,937,939,941],{"class":334,"line":492},[332,932,933],{"class":449},"    \"",[332,935,936],{"class":338},"filters",[332,938,922],{"class":449},[332,940,925],{"class":449},[332,942,943],{"class":449}," [\n",[332,945,946,949,951,954,956,958,961,963,965,967,969,972,974,976,978,981,983,985,987,990,992,994,997],{"class":334,"line":499},[332,947,948],{"class":449},"      {",[332,950,922],{"class":449},[332,952,953],{"class":441},"field",[332,955,922],{"class":449},[332,957,925],{"class":449},[332,959,960],{"class":449}," \"",[332,962,875],{"class":342},[332,964,922],{"class":449},[332,966,521],{"class":449},[332,968,960],{"class":449},[332,970,971],{"class":441},"operator",[332,973,922],{"class":449},[332,975,925],{"class":449},[332,977,960],{"class":449},[332,979,980],{"class":342},"\u003C",[332,982,922],{"class":449},[332,984,521],{"class":449},[332,986,960],{"class":449},[332,988,989],{"class":441},"value",[332,991,922],{"class":449},[332,993,925],{"class":449},[332,995,996],{"class":441}," 100",[332,998,999],{"class":449},"}\n",[332,1001,1002],{"class":334,"line":535},[332,1003,1004],{"class":449},"    ],\n",[332,1006,1008,1010,1013,1015,1017],{"class":334,"line":1007},6,[332,1009,933],{"class":449},[332,1011,1012],{"class":338},"selects",[332,1014,922],{"class":449},[332,1016,925],{"class":449},[332,1018,943],{"class":449},[332,1020,1022,1024,1026,1028,1030,1032,1034,1036,1038],{"class":334,"line":1021},7,[332,1023,948],{"class":449},[332,1025,922],{"class":449},[332,1027,953],{"class":441},[332,1029,922],{"class":449},[332,1031,925],{"class":449},[332,1033,960],{"class":449},[332,1035,868],{"class":342},[332,1037,922],{"class":449},[332,1039,1040],{"class":449},"},\n",[332,1042,1044,1046,1048,1050,1052,1054,1056,1058,1060],{"class":334,"line":1043},8,[332,1045,948],{"class":449},[332,1047,922],{"class":449},[332,1049,953],{"class":441},[332,1051,922],{"class":449},[332,1053,925],{"class":449},[332,1055,960],{"class":449},[332,1057,872],{"class":342},[332,1059,922],{"class":449},[332,1061,1040],{"class":449},[332,1063,1065,1067,1069,1071,1073,1075,1077,1079,1081],{"class":334,"line":1064},9,[332,1066,948],{"class":449},[332,1068,922],{"class":449},[332,1070,953],{"class":441},[332,1072,922],{"class":449},[332,1074,925],{"class":449},[332,1076,960],{"class":449},[332,1078,875],{"class":342},[332,1080,922],{"class":449},[332,1082,999],{"class":449},[332,1084,1086],{"class":334,"line":1085},10,[332,1087,1088],{"class":449},"    ]\n",[332,1090,1092],{"class":334,"line":1091},11,[332,1093,1094],{"class":449},"  }\n",[332,1096,1098],{"class":334,"line":1097},12,[332,1099,999],{"class":449},[322,1101,1103],{"className":901,"code":1102,"language":903,"meta":327,"style":327},"{\n  \"current_page\": 1,\n  \"data\": [\n    {\"id\": 1, \"name\": \"Desk lamp\", \"price\": 39}\n  ],\n  \"from\": 1,\n  \"last_page\": 1,\n  \"per_page\": 50,\n  \"to\": 1,\n  \"total\": 1,\n  \"meta\": {}\n}\n",[329,1104,1105,1109,1126,1139,1186,1191,1206,1221,1237,1252,1267,1281],{"__ignoreMap":327},[332,1106,1107],{"class":334,"line":335},[332,1108,910],{"class":449},[332,1110,1111,1113,1116,1118,1120,1123],{"class":334,"line":469},[332,1112,915],{"class":449},[332,1114,1115],{"class":918},"current_page",[332,1117,922],{"class":449},[332,1119,925],{"class":449},[332,1121,1122],{"class":441}," 1",[332,1124,1125],{"class":449},",\n",[332,1127,1128,1130,1133,1135,1137],{"class":334,"line":492},[332,1129,915],{"class":449},[332,1131,1132],{"class":918},"data",[332,1134,922],{"class":449},[332,1136,925],{"class":449},[332,1138,943],{"class":449},[332,1140,1141,1144,1146,1148,1150,1152,1154,1156,1158,1160,1162,1164,1166,1169,1171,1173,1175,1177,1179,1181,1184],{"class":334,"line":499},[332,1142,1143],{"class":449},"    {",[332,1145,922],{"class":449},[332,1147,868],{"class":338},[332,1149,922],{"class":449},[332,1151,925],{"class":449},[332,1153,1122],{"class":441},[332,1155,521],{"class":449},[332,1157,960],{"class":449},[332,1159,872],{"class":338},[332,1161,922],{"class":449},[332,1163,925],{"class":449},[332,1165,960],{"class":449},[332,1167,1168],{"class":342},"Desk lamp",[332,1170,922],{"class":449},[332,1172,521],{"class":449},[332,1174,960],{"class":449},[332,1176,875],{"class":338},[332,1178,922],{"class":449},[332,1180,925],{"class":449},[332,1182,1183],{"class":441}," 39",[332,1185,999],{"class":449},[332,1187,1188],{"class":334,"line":535},[332,1189,1190],{"class":449},"  ],\n",[332,1192,1193,1195,1198,1200,1202,1204],{"class":334,"line":1007},[332,1194,915],{"class":449},[332,1196,1197],{"class":918},"from",[332,1199,922],{"class":449},[332,1201,925],{"class":449},[332,1203,1122],{"class":441},[332,1205,1125],{"class":449},[332,1207,1208,1210,1213,1215,1217,1219],{"class":334,"line":1021},[332,1209,915],{"class":449},[332,1211,1212],{"class":918},"last_page",[332,1214,922],{"class":449},[332,1216,925],{"class":449},[332,1218,1122],{"class":441},[332,1220,1125],{"class":449},[332,1222,1223,1225,1228,1230,1232,1235],{"class":334,"line":1043},[332,1224,915],{"class":449},[332,1226,1227],{"class":918},"per_page",[332,1229,922],{"class":449},[332,1231,925],{"class":449},[332,1233,1234],{"class":441}," 50",[332,1236,1125],{"class":449},[332,1238,1239,1241,1244,1246,1248,1250],{"class":334,"line":1064},[332,1240,915],{"class":449},[332,1242,1243],{"class":918},"to",[332,1245,922],{"class":449},[332,1247,925],{"class":449},[332,1249,1122],{"class":441},[332,1251,1125],{"class":449},[332,1253,1254,1256,1259,1261,1263,1265],{"class":334,"line":1085},[332,1255,915],{"class":449},[332,1257,1258],{"class":918},"total",[332,1260,922],{"class":449},[332,1262,925],{"class":449},[332,1264,1122],{"class":441},[332,1266,1125],{"class":449},[332,1268,1269,1271,1274,1276,1278],{"class":334,"line":1091},[332,1270,915],{"class":449},[332,1272,1273],{"class":918},"meta",[332,1275,922],{"class":449},[332,1277,925],{"class":449},[332,1279,1280],{"class":449}," {}\n",[332,1282,1283],{"class":334,"line":1097},[332,1284,999],{"class":449},[359,1286,1287,1297,1303],{},[362,1288,1289,1290,1293,1294,562],{},"A page holds 50 rows unless the request sends ",[329,1291,1292],{},"limit",", one of the resource's ",[329,1295,1296],{},"limits()",[362,1298,1299,1300,1302],{},"Without ",[329,1301,1012],{},", each row holds every selectable field of the resource.",[362,1304,1305,1306,562],{},"A filter on a field that the resource does not declare gives a ",[329,1307,1308],{},"422",[318,1310,1311,1312,562],{},"The search endpoint also takes sorts, includes, aggregates, scopes and a text search. See ",[375,1313,62],{"href":69},[313,1315,1317],{"id":1316},"your-first-mutation","Your first mutation",[318,1319,1320,1321,925],{},"Create a product and attach it to the category ",[329,1322,1323],{},"1",[322,1325,1327],{"className":879,"code":1326,"language":881,"meta":327,"style":327},"POST \u002Fapi\u002Fproducts\u002Fmutate\n",[329,1328,1329],{"__ignoreMap":327},[332,1330,1331],{"class":334,"line":335},[332,1332,1326],{},[322,1334,1336],{"className":901,"code":1335,"language":903,"meta":327,"style":327},"{\n  \"mutate\": [\n    {\n      \"operation\": \"create\",\n      \"attributes\": {\"name\": \"Floor lamp\", \"price\": 129},\n      \"relations\": {\n        \"category\": {\"operation\": \"attach\", \"key\": 1}\n      }\n    }\n  ]\n}\n",[329,1337,1338,1342,1355,1360,1381,1425,1438,1483,1488,1493,1498],{"__ignoreMap":327},[332,1339,1340],{"class":334,"line":335},[332,1341,910],{"class":449},[332,1343,1344,1346,1349,1351,1353],{"class":334,"line":469},[332,1345,915],{"class":449},[332,1347,1348],{"class":918},"mutate",[332,1350,922],{"class":449},[332,1352,925],{"class":449},[332,1354,943],{"class":449},[332,1356,1357],{"class":334,"line":492},[332,1358,1359],{"class":449},"    {\n",[332,1361,1362,1365,1368,1370,1372,1374,1377,1379],{"class":334,"line":499},[332,1363,1364],{"class":449},"      \"",[332,1366,1367],{"class":338},"operation",[332,1369,922],{"class":449},[332,1371,925],{"class":449},[332,1373,960],{"class":449},[332,1375,1376],{"class":342},"create",[332,1378,922],{"class":449},[332,1380,1125],{"class":449},[332,1382,1383,1385,1388,1390,1392,1395,1397,1399,1401,1403,1405,1408,1410,1412,1414,1416,1418,1420,1423],{"class":334,"line":535},[332,1384,1364],{"class":449},[332,1386,1387],{"class":338},"attributes",[332,1389,922],{"class":449},[332,1391,925],{"class":449},[332,1393,1394],{"class":449}," {",[332,1396,922],{"class":449},[332,1398,872],{"class":441},[332,1400,922],{"class":449},[332,1402,925],{"class":449},[332,1404,960],{"class":449},[332,1406,1407],{"class":342},"Floor lamp",[332,1409,922],{"class":449},[332,1411,521],{"class":449},[332,1413,960],{"class":449},[332,1415,875],{"class":441},[332,1417,922],{"class":449},[332,1419,925],{"class":449},[332,1421,1422],{"class":441}," 129",[332,1424,1040],{"class":449},[332,1426,1427,1429,1432,1434,1436],{"class":334,"line":1007},[332,1428,1364],{"class":449},[332,1430,1431],{"class":338},"relations",[332,1433,922],{"class":449},[332,1435,925],{"class":449},[332,1437,928],{"class":449},[332,1439,1440,1443,1446,1448,1450,1452,1454,1457,1459,1461,1463,1466,1468,1470,1472,1475,1477,1479,1481],{"class":334,"line":1021},[332,1441,1442],{"class":449},"        \"",[332,1444,1445],{"class":441},"category",[332,1447,922],{"class":449},[332,1449,925],{"class":449},[332,1451,1394],{"class":449},[332,1453,922],{"class":449},[332,1455,1367],{"class":1456},"swJcz",[332,1458,922],{"class":449},[332,1460,925],{"class":449},[332,1462,960],{"class":449},[332,1464,1465],{"class":342},"attach",[332,1467,922],{"class":449},[332,1469,521],{"class":449},[332,1471,960],{"class":449},[332,1473,1474],{"class":1456},"key",[332,1476,922],{"class":449},[332,1478,925],{"class":449},[332,1480,1122],{"class":441},[332,1482,999],{"class":449},[332,1484,1485],{"class":334,"line":1043},[332,1486,1487],{"class":449},"      }\n",[332,1489,1490],{"class":334,"line":1064},[332,1491,1492],{"class":449},"    }\n",[332,1494,1495],{"class":334,"line":1085},[332,1496,1497],{"class":449},"  ]\n",[332,1499,1500],{"class":334,"line":1091},[332,1501,999],{"class":449},[318,1503,1504,1505,1507],{},"The response gives one entry for each entry of ",[329,1506,1348],{},", with the key of the created row:",[322,1509,1511],{"className":901,"code":1510,"language":903,"meta":327,"style":327},"{\n  \"operations\": [\n    {\"operation\": \"create\", \"key\": 2, \"relations\": {\"category\": {\"operation\": \"attach\", \"key\": 1}}}\n  ]\n}\n",[329,1512,1513,1517,1530,1612,1616],{"__ignoreMap":327},[332,1514,1515],{"class":334,"line":335},[332,1516,910],{"class":449},[332,1518,1519,1521,1524,1526,1528],{"class":334,"line":469},[332,1520,915],{"class":449},[332,1522,1523],{"class":918},"operations",[332,1525,922],{"class":449},[332,1527,925],{"class":449},[332,1529,943],{"class":449},[332,1531,1532,1534,1536,1538,1540,1542,1544,1546,1548,1550,1552,1554,1556,1558,1561,1563,1565,1567,1569,1571,1573,1575,1577,1579,1581,1583,1585,1587,1589,1591,1593,1595,1597,1599,1601,1603,1605,1607,1609],{"class":334,"line":492},[332,1533,1143],{"class":449},[332,1535,922],{"class":449},[332,1537,1367],{"class":338},[332,1539,922],{"class":449},[332,1541,925],{"class":449},[332,1543,960],{"class":449},[332,1545,1376],{"class":342},[332,1547,922],{"class":449},[332,1549,521],{"class":449},[332,1551,960],{"class":449},[332,1553,1474],{"class":338},[332,1555,922],{"class":449},[332,1557,925],{"class":449},[332,1559,1560],{"class":441}," 2",[332,1562,521],{"class":449},[332,1564,960],{"class":449},[332,1566,1431],{"class":338},[332,1568,922],{"class":449},[332,1570,925],{"class":449},[332,1572,1394],{"class":449},[332,1574,922],{"class":449},[332,1576,1445],{"class":441},[332,1578,922],{"class":449},[332,1580,925],{"class":449},[332,1582,1394],{"class":449},[332,1584,922],{"class":449},[332,1586,1367],{"class":1456},[332,1588,922],{"class":449},[332,1590,925],{"class":449},[332,1592,960],{"class":449},[332,1594,1465],{"class":342},[332,1596,922],{"class":449},[332,1598,521],{"class":449},[332,1600,960],{"class":449},[332,1602,1474],{"class":1456},[332,1604,922],{"class":449},[332,1606,925],{"class":449},[332,1608,1122],{"class":441},[332,1610,1611],{"class":449},"}}}\n",[332,1613,1614],{"class":334,"line":499},[332,1615,1497],{"class":449},[332,1617,1618],{"class":334,"line":535},[332,1619,999],{"class":449},[318,1621,1622,1623,1626,1627,1629,1630,1632],{},"The field rules validate each attribute. The generator marks a column that is not nullable and has no default with ",[329,1624,1625],{},"creationRules('required')",". Without such a ",[329,1628,872],{},", the request gives a ",[329,1631,1308],{}," and writes nothing:",[322,1634,1636],{"className":901,"code":1635,"language":903,"meta":327,"style":327},"{\n  \"message\": \"The mutate.0.attributes.name field is required.\",\n  \"errors\": {\n    \"mutate.0.attributes.name\": [\"The mutate.0.attributes.name field is required.\"]\n  }\n}\n",[329,1637,1638,1642,1662,1675,1698,1702],{"__ignoreMap":327},[332,1639,1640],{"class":334,"line":335},[332,1641,910],{"class":449},[332,1643,1644,1646,1649,1651,1653,1655,1658,1660],{"class":334,"line":469},[332,1645,915],{"class":449},[332,1647,1648],{"class":918},"message",[332,1650,922],{"class":449},[332,1652,925],{"class":449},[332,1654,960],{"class":449},[332,1656,1657],{"class":342},"The mutate.0.attributes.name field is required.",[332,1659,922],{"class":449},[332,1661,1125],{"class":449},[332,1663,1664,1666,1669,1671,1673],{"class":334,"line":492},[332,1665,915],{"class":449},[332,1667,1668],{"class":918},"errors",[332,1670,922],{"class":449},[332,1672,925],{"class":449},[332,1674,928],{"class":449},[332,1676,1677,1679,1682,1684,1686,1689,1691,1693,1695],{"class":334,"line":499},[332,1678,933],{"class":449},[332,1680,1681],{"class":338},"mutate.0.attributes.name",[332,1683,922],{"class":449},[332,1685,925],{"class":449},[332,1687,1688],{"class":449}," [",[332,1690,922],{"class":449},[332,1692,1657],{"class":342},[332,1694,922],{"class":449},[332,1696,1697],{"class":449},"]\n",[332,1699,1700],{"class":334,"line":535},[332,1701,1094],{"class":449},[332,1703,1704],{"class":334,"line":1007},[332,1705,999],{"class":449},[318,1707,1708,1709,1711,1712,1715],{},"See ",[375,1710,106],{"href":107}," for updates, nested writes and the ",[329,1713,1714],{},"response"," block that returns the written rows.",[313,1717,1719],{"id":1718},"next-steps","Next steps",[359,1721,1722,1727,1732,1737],{},[362,1723,1724,1726],{},[375,1725,33],{"href":39},": write and register a resource by hand.",[362,1728,1729,1731],{},[375,1730,42],{"href":43},": choose what clients read, filter, sort and write.",[362,1733,1734,1736],{},[375,1735,54],{"href":55},": decide which rows exist for each client.",[362,1738,1739,1741],{},[375,1740,24],{"href":25},": change the defaults of the package.",[1743,1744,1745],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}",{"title":327,"searchDepth":335,"depth":469,"links":1747},[1748,1753,1754,1755,1756],{"id":315,"depth":469,"text":316,"children":1749},[1750,1751,1752],{"id":566,"depth":492,"text":567},{"id":614,"depth":492,"text":615},{"id":726,"depth":492,"text":727},{"id":797,"depth":469,"text":798},{"id":857,"depth":469,"text":858},{"id":1316,"depth":469,"text":1317},{"id":1718,"depth":469,"text":1719},"Expose your first models with rest:quick-start, then send your first search and mutate requests.","md",null,{},{"title":20,"description":1757},{"loc":21},"jxDsE9wboEL0FgkHJYAY-bM4xA4zOLMGN5UXf-YaC8s",[1765,1767],{"title":16,"path":17,"stem":18,"description":1766,"children":-1},"Install Laravel Rest Api in a Laravel application, publish its configuration and add the optional packages.",{"title":24,"path":25,"stem":26,"description":1768,"children":-1},"Every key of config\u002Frest.php, with its type, its default value and its effect.",1794181351717]