[{"data":1,"prerenderedAt":1698},["ShallowReactive",2],{"navigation":3,"\u002Fsearch\u002Foutside-http":307,"\u002Fsearch\u002Foutside-http-surround":1693},{"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":96,"body":309,"description":1686,"extension":1687,"links":1688,"meta":1689,"navigation":366,"path":97,"seo":1690,"sitemap":1691,"stem":98,"__hash__":1692},"docs3x\u002F3.search\u002F8.outside-http.md",{"type":310,"value":311,"toc":1679},"minimark",[312,320,530,535,605,609,812,929,933,938,1329,1513,1594,1602,1607,1613,1668,1675],[313,314,315,319],"p",{},[316,317,318],"code",{},"Rest::search()"," runs the search of a resource from PHP, for a given user, as the search endpoint runs it. Use it to replay a search payload that a client built: a saved search that a scheduled job sends each morning, a console command that reruns it, or an export of what a user sees. To read rows that your own code chooses, keep using Eloquent.",[321,322,327],"pre",{"className":323,"code":324,"language":325,"meta":326,"style":326},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","use Lomkit\\Rest\\Facades\\Rest;\n\n$search = Rest::search(TicketResource::class)\n    ->as($user)\n    ->payload($savedSearch);\n\n$page = $search->page();          \u002F\u002F LengthAwarePaginator of the models\n$body = $search->render(page: 2); \u002F\u002F the endpoint body, as an array\n$rows = $search->lazy();          \u002F\u002F every rendered row, by chunks\n","php","",[316,328,329,361,368,405,422,438,443,471,506],{"__ignoreMap":326},[330,331,334,338,342,346,349,351,354,356,358],"span",{"class":332,"line":333},"line",1,[330,335,337],{"class":336},"sbssI","use",[330,339,341],{"class":340},"sTEyZ"," Lomkit",[330,343,345],{"class":344},"sMK4o","\\",[330,347,348],{"class":340},"Rest",[330,350,345],{"class":344},[330,352,353],{"class":340},"Facades",[330,355,345],{"class":344},[330,357,348],{"class":340},[330,359,360],{"class":344},";\n",[330,362,364],{"class":332,"line":363},2,[330,365,367],{"emptyLinePlaceholder":366},true,"\n",[330,369,371,374,377,380,384,387,391,394,397,399,402],{"class":332,"line":370},3,[330,372,373],{"class":344},"$",[330,375,376],{"class":340},"search ",[330,378,379],{"class":344},"=",[330,381,383],{"class":382},"sBMFI"," Rest",[330,385,386],{"class":344},"::",[330,388,390],{"class":389},"s2Zo4","search",[330,392,393],{"class":344},"(",[330,395,396],{"class":382},"TicketResource",[330,398,386],{"class":344},[330,400,401],{"class":336},"class",[330,403,404],{"class":344},")\n",[330,406,408,411,414,417,420],{"class":332,"line":407},4,[330,409,410],{"class":344},"    ->",[330,412,413],{"class":389},"as",[330,415,416],{"class":344},"($",[330,418,419],{"class":340},"user",[330,421,404],{"class":344},[330,423,425,427,430,432,435],{"class":332,"line":424},5,[330,426,410],{"class":344},[330,428,429],{"class":389},"payload",[330,431,416],{"class":344},[330,433,434],{"class":340},"savedSearch",[330,436,437],{"class":344},");\n",[330,439,441],{"class":332,"line":440},6,[330,442,367],{"emptyLinePlaceholder":366},[330,444,446,448,451,453,456,458,461,464,467],{"class":332,"line":445},7,[330,447,373],{"class":344},[330,449,450],{"class":340},"page ",[330,452,379],{"class":344},[330,454,455],{"class":344}," $",[330,457,390],{"class":340},[330,459,460],{"class":344},"->",[330,462,463],{"class":389},"page",[330,465,466],{"class":344},"();",[330,468,470],{"class":469},"sHwdD","          \u002F\u002F LengthAwarePaginator of the models\n",[330,472,474,476,479,481,483,485,487,490,492,494,497,500,503],{"class":332,"line":473},8,[330,475,373],{"class":344},[330,477,478],{"class":340},"body ",[330,480,379],{"class":344},[330,482,455],{"class":344},[330,484,390],{"class":340},[330,486,460],{"class":344},[330,488,489],{"class":389},"render",[330,491,393],{"class":344},[330,493,463],{"class":382},[330,495,496],{"class":344},":",[330,498,499],{"class":336}," 2",[330,501,502],{"class":344},");",[330,504,505],{"class":469}," \u002F\u002F the endpoint body, as an array\n",[330,507,509,511,514,516,518,520,522,525,527],{"class":332,"line":508},9,[330,510,373],{"class":344},[330,512,513],{"class":340},"rows ",[330,515,379],{"class":344},[330,517,455],{"class":344},[330,519,390],{"class":340},[330,521,460],{"class":344},[330,523,524],{"class":389},"lazy",[330,526,466],{"class":344},[330,528,529],{"class":469},"          \u002F\u002F every rendered row, by chunks\n",[531,532,534],"h2",{"id":533},"the-builder","The builder",[536,537,538,562,575,585,596],"ul",{},[539,540,541,544,545,547,548,551,552,555,556,558,559,561],"li",{},[316,542,543],{},"payload()"," takes the value of the ",[316,546,390],{}," key of the endpoint body. It is validated with the rules and limits of the endpoint. A failure throws ",[316,549,550],{},"Illuminate\\Validation\\ValidationException"," with the keys and messages of the endpoint, such as ",[316,553,554],{},"search.filters.0.field",". Without ",[316,557,543],{},", the search runs as an endpoint body without ",[316,560,390],{},".",[539,563,564,567,568,571,572],{},[316,565,566],{},"as()"," is required. Without it, the search throws ",[316,569,570],{},"SearchRunException",": ",[316,573,574],{},"The search of the resource [App\\Rest\\Resources\\TicketResource] has no user. Call as() with the user, or as(null) to search as a guest.",[539,576,577,580,581,584],{},[316,578,579],{},"as(null)"," searches as a guest, also when a user is logged in. ",[316,582,583],{},"as($user, 'api')"," names the guard of the user; the default guard applies otherwise.",[539,586,587,588,591,592,595],{},"The given user is the one that ",[316,589,590],{},"$this->request()->user()"," returns in ",[316,593,594],{},"perimeterQuery()",", in the declarations of the resources and in their hooks, at every include level. The policies and the decision cache use that user and guard. The logged-in user and the default guard of the application do not change.",[539,597,598,601,602,561],{},[316,599,600],{},"viewAny"," is checked before the search, as on the endpoint: a denial throws ",[316,603,604],{},"Lomkit\\Rest\\Exceptions\\AuthorizationDenied",[531,606,608],{"id":607},"page-and-render","page() and render()",[321,610,612],{"className":323,"code":611,"language":325,"meta":326,"style":326},"use Illuminate\\Support\\Facades\\Mail;\nuse Lomkit\\Rest\\Facades\\Rest;\n\npublic function handle(): void\n{\n    $page = Rest::search(TicketResource::class)\n        ->as($this->user)\n        ->payload($this->savedSearch->payload)\n        ->page();\n\n    Mail::to($this->user)->send(new OpenTickets($page->items(), $page->total()));\n}\n",[316,613,614,637,657,661,679,684,709,723,739,748,753,806],{"__ignoreMap":326},[330,615,616,618,621,623,626,628,630,632,635],{"class":332,"line":333},[330,617,337],{"class":336},[330,619,620],{"class":340}," Illuminate",[330,622,345],{"class":344},[330,624,625],{"class":340},"Support",[330,627,345],{"class":344},[330,629,353],{"class":340},[330,631,345],{"class":344},[330,633,634],{"class":340},"Mail",[330,636,360],{"class":344},[330,638,639,641,643,645,647,649,651,653,655],{"class":332,"line":363},[330,640,337],{"class":336},[330,642,341],{"class":340},[330,644,345],{"class":344},[330,646,348],{"class":340},[330,648,345],{"class":344},[330,650,353],{"class":340},[330,652,345],{"class":344},[330,654,348],{"class":340},[330,656,360],{"class":344},[330,658,659],{"class":332,"line":370},[330,660,367],{"emptyLinePlaceholder":366},[330,662,663,667,670,673,676],{"class":332,"line":407},[330,664,666],{"class":665},"spNyl","public",[330,668,669],{"class":665}," function",[330,671,672],{"class":389}," handle",[330,674,675],{"class":344},"():",[330,677,678],{"class":336}," void\n",[330,680,681],{"class":332,"line":424},[330,682,683],{"class":344},"{\n",[330,685,686,689,691,693,695,697,699,701,703,705,707],{"class":332,"line":440},[330,687,688],{"class":344},"    $",[330,690,450],{"class":340},[330,692,379],{"class":344},[330,694,383],{"class":382},[330,696,386],{"class":344},[330,698,390],{"class":389},[330,700,393],{"class":344},[330,702,396],{"class":382},[330,704,386],{"class":344},[330,706,401],{"class":336},[330,708,404],{"class":344},[330,710,711,714,716,719,721],{"class":332,"line":445},[330,712,713],{"class":344},"        ->",[330,715,413],{"class":389},[330,717,718],{"class":344},"($this->",[330,720,419],{"class":340},[330,722,404],{"class":344},[330,724,725,727,729,731,733,735,737],{"class":332,"line":473},[330,726,713],{"class":344},[330,728,429],{"class":389},[330,730,718],{"class":344},[330,732,434],{"class":340},[330,734,460],{"class":344},[330,736,429],{"class":340},[330,738,404],{"class":344},[330,740,741,743,745],{"class":332,"line":508},[330,742,713],{"class":344},[330,744,463],{"class":389},[330,746,747],{"class":344},"();\n",[330,749,751],{"class":332,"line":750},10,[330,752,367],{"emptyLinePlaceholder":366},[330,754,756,759,761,764,766,768,771,774,776,779,782,784,786,788,791,794,796,798,800,803],{"class":332,"line":755},11,[330,757,758],{"class":382},"    Mail",[330,760,386],{"class":344},[330,762,763],{"class":389},"to",[330,765,718],{"class":344},[330,767,419],{"class":340},[330,769,770],{"class":344},")->",[330,772,773],{"class":389},"send",[330,775,393],{"class":344},[330,777,778],{"class":336},"new",[330,780,781],{"class":382}," OpenTickets",[330,783,416],{"class":344},[330,785,463],{"class":340},[330,787,460],{"class":344},[330,789,790],{"class":389},"items",[330,792,793],{"class":344},"(),",[330,795,455],{"class":344},[330,797,463],{"class":340},[330,799,460],{"class":344},[330,801,802],{"class":389},"total",[330,804,805],{"class":344},"()));\n",[330,807,809],{"class":332,"line":808},12,[330,810,811],{"class":344},"}\n",[536,813,814,824,838,860,875,890,914],{},[539,815,816,819,820,823],{},[316,817,818],{},"page()"," returns the ",[316,821,822],{},"Illuminate\\Contracts\\Pagination\\LengthAwarePaginator"," of the models of the page, with their includes cut to their limits.",[539,825,826,829,830,833,834,837],{},[316,827,828],{},"render()"," returns the body of the endpoint as an array: ",[316,831,832],{},"json_encode($body)"," is the content that the endpoint answers for the same user and payload, ",[316,835,836],{},"meta"," included.",[539,839,840,841,844,845,847,848,851,852,855,856,859],{},"The objects that stay ",[316,842,843],{},"{}"," when empty, such as ",[316,846,836],{},", ",[316,849,850],{},"pivot"," and ",[316,853,854],{},"gates",", are ",[316,857,858],{},"stdClass"," instances in that array.",[539,861,862,851,865,868,869,871,872,561],{},[316,863,864],{},"page(page: 2)",[316,866,867],{},"render(page: 2)"," read that page instead of the ",[316,870,463],{}," of the payload. It is validated as ",[316,873,874],{},"search.page",[539,876,877,851,879,881,882,885,886,889],{},[316,878,818],{},[316,880,828],{}," run ",[316,883,884],{},"searching()"," before the query and ",[316,887,888],{},"searched()"," after it, as on the endpoint.",[539,891,892,851,894,896,897,900,901,904,905,908,909,561],{},[316,893,818],{},[316,895,828],{}," are bounded by ",[316,898,899],{},"rest.limits.sizes.rows",", as a page of the endpoint: ",[316,902,903],{},"The search field takes the response over the limit of 49 rows: it can render up to 50 rows."," for a page of 50 rows with the limit set to 49. ",[316,906,907],{},"lazy()"," does not count rows. See ",[910,911,913],"a",{"href":912},"\u002Fresources\u002Flimits#response-rows","Response rows",[539,915,916,917,920,921,924,925,561],{},"The values of a row follow the type of their field, as on the endpoint: a ",[316,918,919],{},"Number"," value is a number, and an empty ",[316,922,923],{},"Json"," value is an object. See ",[910,926,928],{"href":927},"\u002Fresources\u002Ffields#value-types-in-rows","Value types in rows",[531,930,932],{"id":931},"lazy-and-exports","lazy() and exports",[313,934,935,937],{},[316,936,907],{}," reads every row of the search. Here, an export of the tickets that the user sees, with the filters of the client, streamed in the request:",[321,939,942],{"className":323,"code":940,"filename":941,"language":325,"meta":326,"style":326},"use Illuminate\\Http\\Request;\nuse Lomkit\\Rest\\Facades\\Rest;\nuse Symfony\\Component\\HttpFoundation\\StreamedResponse;\n\npublic function __invoke(Request $request): StreamedResponse\n{\n    $rows = Rest::search(TicketResource::class)\n        ->as($request->user())\n        ->payload($request->input('search', []))\n        ->lazy();\n\n    return response()->streamDownload(function () use ($rows): void {\n        $file = fopen('php:\u002F\u002Foutput', 'w');\n\n        foreach ($rows as $row) {\n            fputcsv($file, [$row['id'], $row['title'], $row['status']]);\n        }\n\n        fclose($file);\n    }, 'tickets.csv');\n}\n","app\u002FHttp\u002FControllers\u002FTicketExportController.php",[316,943,944,962,982,1006,1010,1034,1038,1062,1079,1110,1118,1122,1162,1197,1202,1224,1286,1292,1297,1309,1324],{"__ignoreMap":326},[330,945,946,948,950,952,955,957,960],{"class":332,"line":333},[330,947,337],{"class":336},[330,949,620],{"class":340},[330,951,345],{"class":344},[330,953,954],{"class":340},"Http",[330,956,345],{"class":344},[330,958,959],{"class":340},"Request",[330,961,360],{"class":344},[330,963,964,966,968,970,972,974,976,978,980],{"class":332,"line":363},[330,965,337],{"class":336},[330,967,341],{"class":340},[330,969,345],{"class":344},[330,971,348],{"class":340},[330,973,345],{"class":344},[330,975,353],{"class":340},[330,977,345],{"class":344},[330,979,348],{"class":340},[330,981,360],{"class":344},[330,983,984,986,989,991,994,996,999,1001,1004],{"class":332,"line":370},[330,985,337],{"class":336},[330,987,988],{"class":340}," Symfony",[330,990,345],{"class":344},[330,992,993],{"class":340},"Component",[330,995,345],{"class":344},[330,997,998],{"class":340},"HttpFoundation",[330,1000,345],{"class":344},[330,1002,1003],{"class":340},"StreamedResponse",[330,1005,360],{"class":344},[330,1007,1008],{"class":332,"line":407},[330,1009,367],{"emptyLinePlaceholder":366},[330,1011,1012,1014,1016,1019,1021,1023,1025,1028,1031],{"class":332,"line":424},[330,1013,666],{"class":665},[330,1015,669],{"class":665},[330,1017,1018],{"class":389}," __invoke",[330,1020,393],{"class":344},[330,1022,959],{"class":382},[330,1024,455],{"class":344},[330,1026,1027],{"class":340},"request",[330,1029,1030],{"class":344},"):",[330,1032,1033],{"class":382}," StreamedResponse\n",[330,1035,1036],{"class":332,"line":440},[330,1037,683],{"class":344},[330,1039,1040,1042,1044,1046,1048,1050,1052,1054,1056,1058,1060],{"class":332,"line":445},[330,1041,688],{"class":344},[330,1043,513],{"class":340},[330,1045,379],{"class":344},[330,1047,383],{"class":382},[330,1049,386],{"class":344},[330,1051,390],{"class":389},[330,1053,393],{"class":344},[330,1055,396],{"class":382},[330,1057,386],{"class":344},[330,1059,401],{"class":336},[330,1061,404],{"class":344},[330,1063,1064,1066,1068,1070,1072,1074,1076],{"class":332,"line":473},[330,1065,713],{"class":344},[330,1067,413],{"class":389},[330,1069,416],{"class":344},[330,1071,1027],{"class":340},[330,1073,460],{"class":344},[330,1075,419],{"class":389},[330,1077,1078],{"class":344},"())\n",[330,1080,1081,1083,1085,1087,1089,1091,1094,1096,1099,1102,1104,1107],{"class":332,"line":508},[330,1082,713],{"class":344},[330,1084,429],{"class":389},[330,1086,416],{"class":344},[330,1088,1027],{"class":340},[330,1090,460],{"class":344},[330,1092,1093],{"class":389},"input",[330,1095,393],{"class":344},[330,1097,1098],{"class":344},"'",[330,1100,390],{"class":1101},"sfazB",[330,1103,1098],{"class":344},[330,1105,1106],{"class":344},",",[330,1108,1109],{"class":344}," []))\n",[330,1111,1112,1114,1116],{"class":332,"line":750},[330,1113,713],{"class":344},[330,1115,524],{"class":389},[330,1117,747],{"class":344},[330,1119,1120],{"class":332,"line":755},[330,1121,367],{"emptyLinePlaceholder":366},[330,1123,1124,1128,1131,1134,1137,1139,1142,1145,1148,1151,1154,1156,1159],{"class":332,"line":808},[330,1125,1127],{"class":1126},"s7zQu","    return",[330,1129,1130],{"class":389}," response",[330,1132,1133],{"class":344},"()->",[330,1135,1136],{"class":389},"streamDownload",[330,1138,393],{"class":344},[330,1140,1141],{"class":665},"function",[330,1143,1144],{"class":344}," ()",[330,1146,1147],{"class":336}," use",[330,1149,1150],{"class":344}," ($",[330,1152,1153],{"class":340},"rows",[330,1155,1030],{"class":344},[330,1157,1158],{"class":336}," void",[330,1160,1161],{"class":344}," {\n",[330,1163,1165,1168,1171,1173,1176,1178,1180,1183,1185,1187,1190,1193,1195],{"class":332,"line":1164},13,[330,1166,1167],{"class":344},"        $",[330,1169,1170],{"class":340},"file ",[330,1172,379],{"class":344},[330,1174,1175],{"class":389}," fopen",[330,1177,393],{"class":344},[330,1179,1098],{"class":344},[330,1181,1182],{"class":1101},"php:\u002F\u002Foutput",[330,1184,1098],{"class":344},[330,1186,1106],{"class":344},[330,1188,1189],{"class":344}," '",[330,1191,1192],{"class":1101},"w",[330,1194,1098],{"class":344},[330,1196,437],{"class":344},[330,1198,1200],{"class":332,"line":1199},14,[330,1201,367],{"emptyLinePlaceholder":366},[330,1203,1205,1208,1210,1212,1214,1216,1219,1222],{"class":332,"line":1204},15,[330,1206,1207],{"class":1126},"        foreach",[330,1209,1150],{"class":344},[330,1211,513],{"class":340},[330,1213,413],{"class":344},[330,1215,455],{"class":344},[330,1217,1218],{"class":340},"row",[330,1220,1221],{"class":344},")",[330,1223,1161],{"class":344},[330,1225,1227,1230,1232,1235,1237,1240,1242,1245,1247,1250,1252,1255,1257,1259,1261,1263,1266,1268,1270,1272,1274,1276,1278,1281,1283],{"class":332,"line":1226},16,[330,1228,1229],{"class":389},"            fputcsv",[330,1231,416],{"class":344},[330,1233,1234],{"class":340},"file",[330,1236,1106],{"class":344},[330,1238,1239],{"class":344}," [$",[330,1241,1218],{"class":340},[330,1243,1244],{"class":344},"[",[330,1246,1098],{"class":344},[330,1248,1249],{"class":1101},"id",[330,1251,1098],{"class":344},[330,1253,1254],{"class":344},"],",[330,1256,455],{"class":344},[330,1258,1218],{"class":340},[330,1260,1244],{"class":344},[330,1262,1098],{"class":344},[330,1264,1265],{"class":1101},"title",[330,1267,1098],{"class":344},[330,1269,1254],{"class":344},[330,1271,455],{"class":344},[330,1273,1218],{"class":340},[330,1275,1244],{"class":344},[330,1277,1098],{"class":344},[330,1279,1280],{"class":1101},"status",[330,1282,1098],{"class":344},[330,1284,1285],{"class":344},"]]);\n",[330,1287,1289],{"class":332,"line":1288},17,[330,1290,1291],{"class":344},"        }\n",[330,1293,1295],{"class":332,"line":1294},18,[330,1296,367],{"emptyLinePlaceholder":366},[330,1298,1300,1303,1305,1307],{"class":332,"line":1299},19,[330,1301,1302],{"class":389},"        fclose",[330,1304,416],{"class":344},[330,1306,1234],{"class":340},[330,1308,437],{"class":344},[330,1310,1312,1315,1317,1320,1322],{"class":332,"line":1311},20,[330,1313,1314],{"class":344},"    },",[330,1316,1189],{"class":344},[330,1318,1319],{"class":1101},"tickets.csv",[330,1321,1098],{"class":344},[330,1323,437],{"class":344},[330,1325,1327],{"class":332,"line":1326},21,[330,1328,811],{"class":344},[321,1330,1335],{"className":1331,"code":1332,"filename":1333,"language":1334,"meta":326,"style":326},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"search\": {\n    \"filters\": [{\"field\": \"status\", \"value\": \"open\"}],\n    \"selects\": [{\"field\": \"id\"}, {\"field\": \"title\"}, {\"field\": \"status\"}],\n    \"sorts\": [{\"field\": \"id\"}]\n  }\n}\n","POST \u002Ftickets\u002Fexport","json",[316,1336,1337,1341,1355,1407,1474,1504,1509],{"__ignoreMap":326},[330,1338,1339],{"class":332,"line":333},[330,1340,683],{"class":344},[330,1342,1343,1346,1348,1351,1353],{"class":332,"line":363},[330,1344,1345],{"class":344},"  \"",[330,1347,390],{"class":665},[330,1349,1350],{"class":344},"\"",[330,1352,496],{"class":344},[330,1354,1161],{"class":344},[330,1356,1357,1360,1363,1365,1367,1370,1372,1375,1377,1379,1382,1384,1386,1388,1390,1393,1395,1397,1399,1402,1404],{"class":332,"line":370},[330,1358,1359],{"class":344},"    \"",[330,1361,1362],{"class":382},"filters",[330,1364,1350],{"class":344},[330,1366,496],{"class":344},[330,1368,1369],{"class":344}," [{",[330,1371,1350],{"class":344},[330,1373,1374],{"class":336},"field",[330,1376,1350],{"class":344},[330,1378,496],{"class":344},[330,1380,1381],{"class":344}," \"",[330,1383,1280],{"class":1101},[330,1385,1350],{"class":344},[330,1387,1106],{"class":344},[330,1389,1381],{"class":344},[330,1391,1392],{"class":336},"value",[330,1394,1350],{"class":344},[330,1396,496],{"class":344},[330,1398,1381],{"class":344},[330,1400,1401],{"class":1101},"open",[330,1403,1350],{"class":344},[330,1405,1406],{"class":344},"}],\n",[330,1408,1409,1411,1414,1416,1418,1420,1422,1424,1426,1428,1430,1432,1434,1437,1440,1442,1444,1446,1448,1450,1452,1454,1456,1458,1460,1462,1464,1466,1468,1470,1472],{"class":332,"line":407},[330,1410,1359],{"class":344},[330,1412,1413],{"class":382},"selects",[330,1415,1350],{"class":344},[330,1417,496],{"class":344},[330,1419,1369],{"class":344},[330,1421,1350],{"class":344},[330,1423,1374],{"class":336},[330,1425,1350],{"class":344},[330,1427,496],{"class":344},[330,1429,1381],{"class":344},[330,1431,1249],{"class":1101},[330,1433,1350],{"class":344},[330,1435,1436],{"class":344},"},",[330,1438,1439],{"class":344}," {",[330,1441,1350],{"class":344},[330,1443,1374],{"class":336},[330,1445,1350],{"class":344},[330,1447,496],{"class":344},[330,1449,1381],{"class":344},[330,1451,1265],{"class":1101},[330,1453,1350],{"class":344},[330,1455,1436],{"class":344},[330,1457,1439],{"class":344},[330,1459,1350],{"class":344},[330,1461,1374],{"class":336},[330,1463,1350],{"class":344},[330,1465,496],{"class":344},[330,1467,1381],{"class":344},[330,1469,1280],{"class":1101},[330,1471,1350],{"class":344},[330,1473,1406],{"class":344},[330,1475,1476,1478,1481,1483,1485,1487,1489,1491,1493,1495,1497,1499,1501],{"class":332,"line":424},[330,1477,1359],{"class":344},[330,1479,1480],{"class":382},"sorts",[330,1482,1350],{"class":344},[330,1484,496],{"class":344},[330,1486,1369],{"class":344},[330,1488,1350],{"class":344},[330,1490,1374],{"class":336},[330,1492,1350],{"class":344},[330,1494,496],{"class":344},[330,1496,1381],{"class":344},[330,1498,1249],{"class":1101},[330,1500,1350],{"class":344},[330,1502,1503],{"class":344},"}]\n",[330,1505,1506],{"class":332,"line":440},[330,1507,1508],{"class":344},"  }\n",[330,1510,1511],{"class":332,"line":445},[330,1512,811],{"class":344},[536,1514,1515,1536,1542,1554,1561,1564,1583],{},[539,1516,1517,1520,1521,1524,1525,1528,1529,1532,1533,1535],{},[316,1518,1519],{},"lazy(chunk: 500, max: null)"," returns an ",[316,1522,1523],{},"Illuminate\\Support\\LazyCollection"," of rendered rows. Each row is the row that the endpoint returns in ",[316,1526,1527],{},"data",": its fields, its includes cut to their limits with ",[316,1530,1531],{},"@more",", and the ",[316,1534,854],{}," that the payload asks for.",[539,1537,1538,1539,1541],{},"In order, ",[316,1540,907],{}," returns the rows of every page of the endpoint, each row once.",[539,1543,1544,1545,1547,1548,1550,1551,1553],{},"When ",[316,1546,907],{}," is called, it validates the payload, checks ",[316,1549,600],{},", runs ",[316,1552,884],{}," and reads the keys of the rows in the order of the search. A validation error or a denial throws there, before the streamed response starts.",[539,1555,1556,1557,1560],{},"The rows load and render by chunks of ",[316,1558,1559],{},"chunk"," keys while you iterate, with their includes and aggregates. The query of the keys selects the model key only, so only the keys of all rows stay in memory.",[539,1562,1563],{},"A row deleted after its key was read is skipped. Each iteration loads the rows again.",[539,1565,1566,1569,1570,1572,1573,1575,1576,1579,1580,1582],{},[316,1567,1568],{},"max"," reads the first ",[316,1571,1568],{}," rows only. ",[316,1574,907],{}," ignores the ",[316,1577,1578],{},"limit"," and the ",[316,1581,463],{}," of the payload.",[539,1584,1585,1587,1588,1591,1592,561],{},[316,1586,888],{}," does not run, and an override of ",[316,1589,1590],{},"paginate()"," in the resource does not apply to ",[316,1593,907],{},[1595,1596,1597],"tip",{},[313,1598,1599,1600,561],{},"To export many rows in the background, in the columns that the client picks, use a queued, batched action whose jobs each write a chunk of rows, and let the client download the file. See ",[910,1601,144],{"href":145},[1603,1604,1606],"h3",{"id":1605},"lazy-errors","lazy() errors",[313,1608,1609,1610,496],{},"All of them throw ",[316,1611,1612],{},"Lomkit\\Rest\\Exceptions\\SearchRunException",[1614,1615,1616,1629],"table",{},[1617,1618,1619],"thead",{},[1620,1621,1622,1626],"tr",{},[1623,1624,1625],"th",{},"Case",[1623,1627,1628],{},"Message",[1630,1631,1632,1643,1656],"tbody",{},[1620,1633,1634,1638],{},[1635,1636,1637],"td",{},"A text search on a search engine",[1635,1639,1640],{},[316,1641,1642],{},"The text search of the resource [App\\Rest\\Resources\\TicketResource] runs on a search engine, which returns at most its first 10000 results. lazy() reads every row: search without text, or read the pages with page().",[1620,1644,1645,1651],{},[1635,1646,1647,1648,1650],{},"A ",[316,1649,1559],{}," below 1",[1635,1652,1653],{},[316,1654,1655],{},"The chunk of lazy() must be at least 1, [0] given.",[1620,1657,1658,1663],{},[1635,1659,1660,1661],{},"A negative ",[316,1662,1568],{},[1635,1664,1665],{},[316,1666,1667],{},"The max of lazy() must be at least 0, [-1] given.",[313,1669,1670,1671,1674],{},"The engine message names the result window of the engine, here the 10000 results of Turbopuffer. An engine without a window, such as Meilisearch or Typesense, says ",[316,1672,1673],{},"which returns its results page by page."," instead.",[1676,1677,1678],"style",{},"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 .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}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 .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}",{"title":326,"searchDepth":333,"depth":363,"links":1680},[1681,1682,1683],{"id":533,"depth":363,"text":534},{"id":607,"depth":363,"text":608},{"id":931,"depth":363,"text":932,"children":1684},[1685],{"id":1605,"depth":370,"text":1606},"Replay a client search payload from a job, a command or an export with Rest::search(), with the validation, perimeter and policies of the endpoint.","md",null,{},{"title":96,"description":1686},{"loc":97},"Jwdo5muPpVEkzMsjtuRZosOQH1zrXa5wZyU3H1FsUQg",[1694,1696],{"title":92,"path":93,"stem":94,"description":1695,"children":-1},"Run the text search of a resource on Meilisearch, Typesense, Algolia or another Laravel Scout engine, with an index perimeter.",{"title":106,"path":107,"stem":108,"description":1697,"children":-1},"Create and update rows with their relations in one request and one transaction, read the written rows back, and retry on deadlocks.",1794181354793]