[{"data":1,"prerenderedAt":656},["ShallowReactive",2],{"navigation":3,"\u002Fapi\u002Forder-numbers":72,"\u002Fapi\u002Forder-numbers-surround":651},[4,42,55],{"title":5,"path":6,"stem":7,"children":8,"page":41},"Api","\u002Fapi","api",[9,13,17,21,25,29,33,37],{"title":10,"path":11,"stem":12},"Cart API","\u002Fapi\u002Fcart","api\u002Fcart",{"title":14,"path":15,"stem":16},"Category API","\u002Fapi\u002Fcategory","api\u002Fcategory",{"title":18,"path":19,"stem":20},"Checkout API","\u002Fapi\u002Fcheckout","api\u002Fcheckout",{"title":22,"path":23,"stem":24},"Inventory","\u002Fapi\u002Finventory","api\u002Finventory",{"title":26,"path":27,"stem":28},"Order Numbers","\u002Fapi\u002Forder-numbers","api\u002Forder-numbers",{"title":30,"path":31,"stem":32},"Product API","\u002Fapi\u002Fproduct","api\u002Fproduct",{"title":34,"path":35,"stem":36},"Promotions API","\u002Fapi\u002Fpromotions","api\u002Fpromotions",{"title":38,"path":39,"stem":40},"Taxes","\u002Fapi\u002Ftaxes","api\u002Ftaxes",false,{"title":43,"path":44,"stem":45,"children":46,"page":41},"Getting Started","\u002Fgetting-started","getting-started",[47,51],{"title":48,"path":49,"stem":50},"Admin panel","\u002Fgetting-started\u002Fadmin-panel","getting-started\u002Fadmin-panel",{"title":52,"path":53,"stem":54},"Installation","\u002Fgetting-started\u002Finstallation","getting-started\u002Finstallation",{"title":56,"path":57,"stem":58,"children":59,"page":41},"Tasks","\u002Ftasks","tasks",[60,64,68],{"title":61,"path":62,"stem":63},"Building A Navigation","\u002Ftasks\u002Fbuilding-a-navigation","tasks\u002Fbuilding-a-navigation",{"title":65,"path":66,"stem":67},"Product Detail Page","\u002Ftasks\u002Fproduct-detail-page","tasks\u002Fproduct-detail-page",{"title":69,"path":70,"stem":71},"Product Listing Page","\u002Ftasks\u002Fproduct-listing-page","tasks\u002Fproduct-listing-page",{"id":73,"title":26,"body":74,"description":645,"extension":646,"links":647,"meta":648,"navigation":173,"path":27,"seo":649,"stem":28,"__hash__":650},"docs\u002Fapi\u002Forder-numbers.md",{"type":75,"value":76,"toc":642},"minimark",[77,81,85,108,117,120,127,216,219,226,293,298,309,454,461,481,491,622,635,638],[78,79,26],"h1",{"id":80},"order-numbers",[82,83,84],"p",{},"Every order has three identifiers with separate purposes:",[86,87,88,96,102],"ul",{},[89,90,91,95],"li",{},[92,93,94],"code",{},"id"," is the internal database primary key.",[89,97,98,101],{},[92,99,100],{},"public_id"," is an opaque UUID suitable for storefront URLs and external API\nreferences.",[89,103,104,107],{},[92,105,106],{},"number"," is the human-readable reference used in emails, invoices, and\ncustomer support.",[82,109,110,111,113,114,116],{},"The package generates ",[92,112,100],{}," automatically and enforces its uniqueness in\nthe database. It is intentionally independent of the configurable order number.\nDo not expose the sequential ",[92,115,94],{}," in storefront URLs.",[82,118,119],{},"An unguessable public identifier prevents order enumeration, but it does not\nreplace authorization. Applications remain responsible for checking customer\nownership or otherwise controlling guest access before exposing personal,\npayment, or fulfillment information.",[82,121,122,123,126],{},"Use ",[92,124,125],{},"OrderNumberFactory"," when creating an order. It allocates the sequence in\nthe database, so concurrent requests cannot receive the same sequence.",[128,129,134],"pre",{"className":130,"code":131,"language":132,"meta":133,"style":133},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","use Larasell\\Larasell\\OrderNumbers\\OrderNumberFactory;\n\n$number = app(OrderNumberFactory::class)->generate(); \u002F\u002F LS-000001\n","php","",[92,135,136,168,175],{"__ignoreMap":133},[137,138,141,145,149,153,156,158,161,163,165],"span",{"class":139,"line":140},"line",1,[137,142,144],{"class":143},"sbssI","use",[137,146,148],{"class":147},"sTEyZ"," Larasell",[137,150,152],{"class":151},"sMK4o","\\",[137,154,155],{"class":147},"Larasell",[137,157,152],{"class":151},[137,159,160],{"class":147},"OrderNumbers",[137,162,152],{"class":151},[137,164,125],{"class":147},[137,166,167],{"class":151},";\n",[137,169,171],{"class":139,"line":170},2,[137,172,174],{"emptyLinePlaceholder":173},true,"\n",[137,176,178,181,184,187,191,194,197,200,203,206,209,212],{"class":139,"line":177},3,[137,179,180],{"class":151},"$",[137,182,183],{"class":147},"number ",[137,185,186],{"class":151},"=",[137,188,190],{"class":189},"s2Zo4"," app",[137,192,193],{"class":151},"(",[137,195,125],{"class":196},"sBMFI",[137,198,199],{"class":151},"::",[137,201,202],{"class":143},"class",[137,204,205],{"class":151},")->",[137,207,208],{"class":189},"generate",[137,210,211],{"class":151},"();",[137,213,215],{"class":214},"sHwdD"," \u002F\u002F LS-000001\n",[82,217,218],{},"The sequence table intentionally keeps one small allocation row per number.\nDo not calculate the next number from the latest order, because concurrent\ncheckouts could calculate the same value.",[82,220,221,222,225],{},"Change the default prefix with ",[92,223,224],{},"LARASELL_ORDER_NUMBER_PREFIX",", or publish the\nconfiguration to change its padding:",[128,227,229],{"className":130,"code":228,"language":132,"meta":133,"style":133},"'order_numbers' => [\n    'prefix' => 'ORDER-',\n    'padding' => 8,\n],\n",[92,230,231,248,271,287],{"__ignoreMap":133},[137,232,233,236,240,242,245],{"class":139,"line":140},[137,234,235],{"class":151},"'",[137,237,239],{"class":238},"sfazB","order_numbers",[137,241,235],{"class":151},[137,243,244],{"class":151}," =>",[137,246,247],{"class":151}," [\n",[137,249,250,253,256,258,260,263,266,268],{"class":139,"line":170},[137,251,252],{"class":151},"    '",[137,254,255],{"class":238},"prefix",[137,257,235],{"class":151},[137,259,244],{"class":151},[137,261,262],{"class":151}," '",[137,264,265],{"class":238},"ORDER-",[137,267,235],{"class":151},[137,269,270],{"class":151},",\n",[137,272,273,275,278,280,282,285],{"class":139,"line":177},[137,274,252],{"class":151},[137,276,277],{"class":238},"padding",[137,279,235],{"class":151},[137,281,244],{"class":151},[137,283,284],{"class":143}," 8",[137,286,270],{"class":151},[137,288,290],{"class":139,"line":289},4,[137,291,292],{"class":151},"],\n",[294,295,297],"h2",{"id":296},"custom-formats","Custom formats",[82,299,300,301,304,305,308],{},"Implement ",[92,302,303],{},"OrderNumberGenerator"," when the format needs more than a prefix and\npadding, then configure its class under ",[92,306,307],{},"larasell.order_numbers.generator",".",[128,310,312],{"className":130,"code":311,"language":132,"meta":133,"style":133},"namespace App\\OrderNumbers;\n\nuse Larasell\\Larasell\\Contracts\\OrderNumberGenerator;\n\nclass StoreOrderNumberGenerator implements OrderNumberGenerator\n{\n    public function generate(int $sequence): string\n    {\n        return sprintf('WEB-%08d', $sequence);\n    }\n}\n",[92,313,314,328,332,353,357,372,378,407,413,442,448],{"__ignoreMap":133},[137,315,316,319,322,324,326],{"class":139,"line":140},[137,317,318],{"class":143},"namespace",[137,320,321],{"class":196}," App",[137,323,152],{"class":151},[137,325,160],{"class":196},[137,327,167],{"class":151},[137,329,330],{"class":139,"line":170},[137,331,174],{"emptyLinePlaceholder":173},[137,333,334,336,338,340,342,344,347,349,351],{"class":139,"line":177},[137,335,144],{"class":143},[137,337,148],{"class":147},[137,339,152],{"class":151},[137,341,155],{"class":147},[137,343,152],{"class":151},[137,345,346],{"class":147},"Contracts",[137,348,152],{"class":151},[137,350,303],{"class":147},[137,352,167],{"class":151},[137,354,355],{"class":139,"line":289},[137,356,174],{"emptyLinePlaceholder":173},[137,358,360,363,366,369],{"class":139,"line":359},5,[137,361,202],{"class":362},"spNyl",[137,364,365],{"class":196}," StoreOrderNumberGenerator",[137,367,368],{"class":362}," implements",[137,370,371],{"class":196}," OrderNumberGenerator\n",[137,373,375],{"class":139,"line":374},6,[137,376,377],{"class":151},"{\n",[137,379,381,384,387,390,392,395,398,401,404],{"class":139,"line":380},7,[137,382,383],{"class":362},"    public",[137,385,386],{"class":362}," function",[137,388,389],{"class":189}," generate",[137,391,193],{"class":151},[137,393,394],{"class":143},"int",[137,396,397],{"class":151}," $",[137,399,400],{"class":147},"sequence",[137,402,403],{"class":151},"):",[137,405,406],{"class":143}," string\n",[137,408,410],{"class":139,"line":409},8,[137,411,412],{"class":151},"    {\n",[137,414,416,420,423,425,427,430,432,435,437,439],{"class":139,"line":415},9,[137,417,419],{"class":418},"s7zQu","        return",[137,421,422],{"class":189}," sprintf",[137,424,193],{"class":151},[137,426,235],{"class":151},[137,428,429],{"class":238},"WEB-%08d",[137,431,235],{"class":151},[137,433,434],{"class":151},",",[137,436,397],{"class":151},[137,438,400],{"class":147},[137,440,441],{"class":151},");\n",[137,443,445],{"class":139,"line":444},10,[137,446,447],{"class":151},"    }\n",[137,449,451],{"class":139,"line":450},11,[137,452,453],{"class":151},"}\n",[82,455,456,457,460],{},"Publish Larasell's configuration if the application does not already have a\n",[92,458,459],{},"config\u002Flarasell.php"," file:",[128,462,466],{"className":463,"code":464,"language":465,"meta":133,"style":133},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","php artisan vendor:publish --tag=larasell-config\n","bash",[92,467,468],{"__ignoreMap":133},[137,469,470,472,475,478],{"class":139,"line":140},[137,471,132],{"class":196},[137,473,474],{"class":238}," artisan",[137,476,477],{"class":238}," vendor:publish",[137,479,480],{"class":238}," --tag=larasell-config\n",[82,482,483,484,487,488,490],{},"Then import the custom generator and replace the ",[92,485,486],{},"generator"," entry in\n",[92,489,459],{},":",[128,492,494],{"className":130,"code":493,"language":132,"meta":133,"style":133},"use App\\OrderNumbers\\StoreOrderNumberGenerator;\n\nreturn [\n    \u002F\u002F ...\n\n    'order_numbers' => [\n        'generator' => StoreOrderNumberGenerator::class,\n        'prefix' => env('LARASELL_ORDER_NUMBER_PREFIX', 'LS-'),\n        'padding' => 6,\n    ],\n];\n",[92,495,496,513,517,524,529,533,545,564,597,612,617],{"__ignoreMap":133},[137,497,498,500,502,504,506,508,511],{"class":139,"line":140},[137,499,144],{"class":143},[137,501,321],{"class":147},[137,503,152],{"class":151},[137,505,160],{"class":147},[137,507,152],{"class":151},[137,509,510],{"class":147},"StoreOrderNumberGenerator",[137,512,167],{"class":151},[137,514,515],{"class":139,"line":170},[137,516,174],{"emptyLinePlaceholder":173},[137,518,519,522],{"class":139,"line":177},[137,520,521],{"class":418},"return",[137,523,247],{"class":151},[137,525,526],{"class":139,"line":289},[137,527,528],{"class":214},"    \u002F\u002F ...\n",[137,530,531],{"class":139,"line":359},[137,532,174],{"emptyLinePlaceholder":173},[137,534,535,537,539,541,543],{"class":139,"line":374},[137,536,252],{"class":151},[137,538,239],{"class":238},[137,540,235],{"class":151},[137,542,244],{"class":151},[137,544,247],{"class":151},[137,546,547,550,552,554,556,558,560,562],{"class":139,"line":380},[137,548,549],{"class":151},"        '",[137,551,486],{"class":238},[137,553,235],{"class":151},[137,555,244],{"class":151},[137,557,365],{"class":196},[137,559,199],{"class":151},[137,561,202],{"class":143},[137,563,270],{"class":151},[137,565,566,568,570,572,574,577,579,581,583,585,587,589,592,594],{"class":139,"line":409},[137,567,549],{"class":151},[137,569,255],{"class":238},[137,571,235],{"class":151},[137,573,244],{"class":151},[137,575,576],{"class":189}," env",[137,578,193],{"class":151},[137,580,235],{"class":151},[137,582,224],{"class":238},[137,584,235],{"class":151},[137,586,434],{"class":151},[137,588,262],{"class":151},[137,590,591],{"class":238},"LS-",[137,593,235],{"class":151},[137,595,596],{"class":151},"),\n",[137,598,599,601,603,605,607,610],{"class":139,"line":415},[137,600,549],{"class":151},[137,602,277],{"class":238},[137,604,235],{"class":151},[137,606,244],{"class":151},[137,608,609],{"class":143}," 6",[137,611,270],{"class":151},[137,613,614],{"class":139,"line":444},[137,615,616],{"class":151},"    ],\n",[137,618,619],{"class":139,"line":450},[137,620,621],{"class":151},"];\n",[82,623,624,625,627,628,630,631,634],{},"The ",[92,626,255],{}," and ",[92,629,277],{}," settings are used only by the default\n",[92,632,633],{},"SequentialOrderNumberGenerator",". A custom generator may define and read its\nown configuration values.",[82,636,637],{},"Custom generators must preserve the uniqueness of the supplied sequence in\ntheir result. The generated value should be stored in a uniquely indexed order\ncolumn when the order is created.",[639,640,641],"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 .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}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 .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}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":133,"searchDepth":140,"depth":170,"links":643},[644],{"id":296,"depth":170,"text":297},"Generate customizable, concurrency-safe order numbers.","md",null,{},{"title":26,"description":645},"tQqZHZxA3V8ZNVriadXlmR5RgJkkqJN8EP28YzSWd0o",[652,654],{"title":22,"path":23,"stem":24,"description":653,"children":-1},"Reserve, consume, release, and expire product inventory.",{"title":30,"path":31,"stem":32,"description":655,"children":-1},"Fetch visible products and their attached categories.",1789114878354]