[{"data":1,"prerenderedAt":773},["ShallowReactive",2],{"navigation":3,"\u002Fguides\u002Fadd-a-domain":193,"\u002Fguides\u002Fadd-a-domain-surround":768},[4,27,49,99,149,169,183],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":26},"Getting Started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,14,18,22],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick Start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",{"title":23,"path":24,"stem":25},"Existing Application","\u002Fgetting-started\u002Fexisting-application","1.getting-started\u002F4.existing-application",false,{"title":28,"icon":29,"path":30,"stem":31,"children":32,"page":26},"Concepts","i-lucide-layers","\u002Fconcepts","2.concepts",[33,37,41,45],{"title":34,"path":35,"stem":36},"Layers","\u002Fconcepts\u002Flayers","2.concepts\u002F1.layers",{"title":38,"path":39,"stem":40},"Buckets","\u002Fconcepts\u002Fbuckets","2.concepts\u002F2.buckets",{"title":42,"path":43,"stem":44},"Boundaries","\u002Fconcepts\u002Fboundaries","2.concepts\u002F3.boundaries",{"title":46,"path":47,"stem":48},"Service Providers","\u002Fconcepts\u002Fservice-providers","2.concepts\u002F4.service-providers",{"title":50,"icon":51,"path":52,"stem":53,"children":54,"page":26},"Guides","i-lucide-book-marked","\u002Fguides","3.guides",[55,59,63,67,71,75,79,83,87,91,95],{"title":56,"path":57,"stem":58},"Add a Domain","\u002Fguides\u002Fadd-a-domain","3.guides\u002F01.add-a-domain",{"title":60,"path":61,"stem":62},"Share Code Between Layers","\u002Fguides\u002Fshare-code-between-layers","3.guides\u002F02.share-code-between-layers",{"title":64,"path":65,"stem":66},"Routes","\u002Fguides\u002Froutes","3.guides\u002F03.routes",{"title":68,"path":69,"stem":70},"Views and Components","\u002Fguides\u002Fviews-and-components","3.guides\u002F04.views-and-components",{"title":72,"path":73,"stem":74},"Seeders","\u002Fguides\u002Fseeders","3.guides\u002F05.seeders",{"title":76,"path":77,"stem":78},"Configuration","\u002Fguides\u002Fconfiguration","3.guides\u002F06.configuration",{"title":80,"path":81,"stem":82},"Events","\u002Fguides\u002Fevents","3.guides\u002F07.events",{"title":84,"path":85,"stem":86},"Tests and CI","\u002Fguides\u002Ftesting-and-ci","3.guides\u002F08.testing-and-ci",{"title":88,"path":89,"stem":90},"Production","\u002Fguides\u002Fproduction","3.guides\u002F09.production",{"title":92,"path":93,"stem":94},"Remove a Layer","\u002Fguides\u002Fremoving-a-layer","3.guides\u002F10.removing-a-layer",{"title":96,"path":97,"stem":98},"Multi-tenancy","\u002Fguides\u002Fmulti-tenancy","3.guides\u002F11.multi-tenancy",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":26},"Commands","i-lucide-terminal","\u002Fcommands","4.commands",[105,109,113,117,121,125,129,133,137,141,145],{"title":106,"path":107,"stem":108},"Overview","\u002Fcommands\u002Foverview","4.commands\u002F01.overview",{"title":110,"path":111,"stem":112},"osdd:start","\u002Fcommands\u002Fosdd-start","4.commands\u002F02.osdd-start",{"title":114,"path":115,"stem":116},"osdd:layer","\u002Fcommands\u002Fosdd-layer","4.commands\u002F03.osdd-layer",{"title":118,"path":119,"stem":120},"osdd:list","\u002Fcommands\u002Fosdd-list","4.commands\u002F04.osdd-list",{"title":122,"path":123,"stem":124},"osdd:check","\u002Fcommands\u002Fosdd-check","4.commands\u002F05.osdd-check",{"title":126,"path":127,"stem":128},"osdd:graph","\u002Fcommands\u002Fosdd-graph","4.commands\u002F06.osdd-graph",{"title":130,"path":131,"stem":132},"osdd:seed","\u002Fcommands\u002Fosdd-seed","4.commands\u002F07.osdd-seed",{"title":134,"path":135,"stem":136},"osdd:phpunit","\u002Fcommands\u002Fosdd-phpunit","4.commands\u002F08.osdd-phpunit",{"title":138,"path":139,"stem":140},"osdd:remove","\u002Fcommands\u002Fosdd-remove","4.commands\u002F09.osdd-remove",{"title":142,"path":143,"stem":144},"osdd:cache","\u002Fcommands\u002Fosdd-cache","4.commands\u002F10.osdd-cache",{"title":146,"path":147,"stem":148},"Generators","\u002Fcommands\u002Fmake-commands","4.commands\u002F11.make-commands",{"title":150,"icon":151,"path":152,"stem":153,"children":154,"page":26},"API Reference","i-lucide-book-open","\u002Fapi-reference","5.api-reference",[155,159,162,166],{"title":156,"path":157,"stem":158},"LayerServiceProvider","\u002Fapi-reference\u002Flayer-service-provider","5.api-reference\u002F1.layer-service-provider",{"title":34,"path":160,"stem":161},"\u002Fapi-reference\u002Flayers","5.api-reference\u002F2.layers",{"title":163,"path":164,"stem":165},"SeederRegistry","\u002Fapi-reference\u002Fseeder-registry","5.api-reference\u002F3.seeder-registry",{"title":76,"path":167,"stem":168},"\u002Fapi-reference\u002Fconfiguration","5.api-reference\u002F4.configuration",{"title":170,"icon":171,"path":172,"stem":173,"children":174,"page":26},"Integrations","i-lucide-puzzle","\u002Fintegrations","6.integrations",[175,179],{"title":176,"path":177,"stem":178},"Laravel Boost","\u002Fintegrations\u002Flaravel-boost","6.integrations\u002F1.laravel-boost",{"title":180,"path":181,"stem":182},"Tinker and IDE Helper","\u002Fintegrations\u002Ftinker-and-ide-helper","6.integrations\u002F2.tinker-and-ide-helper",{"title":184,"icon":185,"path":186,"stem":187,"children":188,"page":26},"Upgrade","i-lucide-arrow-up-circle","\u002Fupgrade","7.upgrade",[189],{"title":190,"path":191,"stem":192},"Upgrade from 2.x","\u002Fupgrade\u002Ffrom-2x","7.upgrade\u002F1.from-2x",{"id":194,"title":56,"body":195,"description":761,"extension":762,"links":763,"meta":764,"navigation":469,"path":57,"seo":765,"sitemap":766,"stem":58,"__hash__":767},"docs\u002F3.guides\u002F01.add-a-domain.md",{"type":196,"value":197,"toc":759},"minimark",[198,219,746,755],[199,200,201,202,206,207,210,211,214,215,218],"p",{},"This guide adds an ",[203,204,205],"code",{},"invoices"," domain that depends on an existing ",[203,208,209],{},"functional\u002Forders"," layer. Every file lands in ",[203,212,213],{},"functional\u002Finvoices",", and nothing is written to ",[203,216,217],{},"app\u002F",".",[220,221,223,228,282,340,344,367,373,381,396,400,506,519,523,537,650,654,694,708,712],"steps",{"level":222},"3",[224,225,227],"h3",{"id":226},"create-the-layer","Create the layer",[229,230,235],"pre",{"className":231,"code":232,"language":233,"meta":234,"style":234},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","php artisan osdd:layer functional\u002Finvoices \\\n    --generators=provider,routes,test \\\n    --requires=functional\u002Forders \\\n    --composer-update\n","bash","",[203,236,237,260,268,276],{"__ignoreMap":234},[238,239,242,246,250,253,256],"span",{"class":240,"line":241},"line",1,[238,243,245],{"class":244},"sBMFI","php",[238,247,249],{"class":248},"sfazB"," artisan",[238,251,252],{"class":248}," osdd:layer",[238,254,255],{"class":248}," functional\u002Finvoices",[238,257,259],{"class":258},"sTEyZ"," \\\n",[238,261,263,266],{"class":240,"line":262},2,[238,264,265],{"class":248},"    --generators=provider,routes,test",[238,267,259],{"class":258},[238,269,271,274],{"class":240,"line":270},3,[238,272,273],{"class":248},"    --requires=functional\u002Forders",[238,275,259],{"class":258},[238,277,279],{"class":240,"line":278},4,[238,280,281],{"class":248},"    --composer-update\n",[283,284,285,296,315,334],"ul",{},[286,287,288,291,292,295],"li",{},[203,289,290],{},"provider"," writes ",[203,293,294],{},"InvoicesServiceProvider",", which already loads the layer's migrations, routes, views and translations.",[286,297,298,301,302,305,306,305,309,305,312,218],{},[203,299,300],{},"routes"," writes the four route files: ",[203,303,304],{},"web.php",", ",[203,307,308],{},"api.php",[203,310,311],{},"console.php",[203,313,314],{},"channels.php",[286,316,317,320,321,323,324,327,328,333],{},[203,318,319],{},"--requires"," declares the dependency on ",[203,322,209],{}," in the layer's ",[203,325,326],{},"composer.json",", so ",[329,330,331],"a",{"href":123},[203,332,122],{}," accepts it.",[286,335,336,339],{},[203,337,338],{},"--composer-update"," installs the layer, so Laravel discovers its provider.",[224,341,343],{"id":342},"generate-the-resource","Generate the resource",[229,345,347],{"className":231,"code":346,"language":233,"meta":234,"style":234},"php artisan osdd:model Invoice --all --layer=functional\u002Finvoices\n",[203,348,349],{"__ignoreMap":234},[238,350,351,353,355,358,361,364],{"class":240,"line":241},[238,352,245],{"class":244},[238,354,249],{"class":248},[238,356,357],{"class":248}," osdd:model",[238,359,360],{"class":248}," Invoice",[238,362,363],{"class":248}," --all",[238,365,366],{"class":248}," --layer=functional\u002Finvoices\n",[199,368,369,372],{},[203,370,371],{},"--all"," creates every companion inside the same layer:",[229,374,379],{"className":375,"code":377,"language":378},[376],"language-text","functional\u002Finvoices\u002F\n├── src\u002F\n│   ├── Models\u002FInvoice.php\n│   ├── Policies\u002FInvoicePolicy.php\n│   ├── Http\u002FControllers\u002FInvoiceController.php\n│   └── Http\u002FRequests\u002FStoreInvoiceRequest.php, UpdateInvoiceRequest.php\n└── database\u002F\n    ├── factories\u002FInvoiceFactory.php\n    ├── migrations\u002F\u003Ctimestamp>_create_invoices_table.php\n    └── seeders\u002FInvoiceSeeder.php\n","text",[203,380,377],{"__ignoreMap":234},[199,382,383,384,387,388,391,392,395],{},"The seeder is registered in the layer provider with ",[203,385,386],{},"loadSeeders()",". The policy needs no registration: Laravel finds ",[203,389,390],{},"Functional\\Invoices\\Policies\\InvoicePolicy"," for ",[203,393,394],{},"Functional\\Invoices\\Models\\Invoice"," by convention.",[224,397,399],{"id":398},"add-the-routes","Add the routes",[229,401,405],{"className":402,"code":403,"filename":404,"language":245,"meta":234,"style":234},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","use Functional\\Invoices\\Http\\Controllers\\InvoiceController;\nuse Illuminate\\Support\\Facades\\Route;\n\nRoute::resource('invoices', InvoiceController::class);\n","functional\u002Finvoices\u002Froutes\u002Fweb.php",[203,406,407,441,465,471],{"__ignoreMap":234},[238,408,409,413,416,420,423,425,428,430,433,435,438],{"class":240,"line":241},[238,410,412],{"class":411},"sbssI","use",[238,414,415],{"class":258}," Functional",[238,417,419],{"class":418},"sMK4o","\\",[238,421,422],{"class":258},"Invoices",[238,424,419],{"class":418},[238,426,427],{"class":258},"Http",[238,429,419],{"class":418},[238,431,432],{"class":258},"Controllers",[238,434,419],{"class":418},[238,436,437],{"class":258},"InvoiceController",[238,439,440],{"class":418},";\n",[238,442,443,445,448,450,453,455,458,460,463],{"class":240,"line":262},[238,444,412],{"class":411},[238,446,447],{"class":258}," Illuminate",[238,449,419],{"class":418},[238,451,452],{"class":258},"Support",[238,454,419],{"class":418},[238,456,457],{"class":258},"Facades",[238,459,419],{"class":418},[238,461,462],{"class":258},"Route",[238,464,440],{"class":418},[238,466,467],{"class":240,"line":270},[238,468,470],{"emptyLinePlaceholder":469},true,"\n",[238,472,473,475,478,482,485,488,490,492,495,498,500,503],{"class":240,"line":278},[238,474,462],{"class":244},[238,476,477],{"class":418},"::",[238,479,481],{"class":480},"s2Zo4","resource",[238,483,484],{"class":418},"(",[238,486,487],{"class":418},"'",[238,489,205],{"class":248},[238,491,487],{"class":418},[238,493,494],{"class":418},",",[238,496,497],{"class":244}," InvoiceController",[238,499,477],{"class":418},[238,501,502],{"class":411},"class",[238,504,505],{"class":418},");\n",[199,507,508,509,512,513,516,517,218],{},"The provider's ",[203,510,511],{},"withRouting()"," already mounts this file in the ",[203,514,515],{},"web"," middleware group. See ",[329,518,64],{"href":65},[224,520,522],{"id":521},"use-the-other-layer","Use the other layer",[199,524,525,526,529,530,533,534,536],{},"The migration can reference the ",[203,527,528],{},"orders"," table, and the model the ",[203,531,532],{},"Order"," model, because the layer requires ",[203,535,209],{},":",[229,538,541],{"className":402,"code":539,"filename":540,"language":245,"meta":234,"style":234},"use Functional\\Orders\\Models\\Order;\nuse Illuminate\\Database\\Eloquent\\Relations\\BelongsTo;\n\npublic function order(): BelongsTo\n{\n    return $this->belongsTo(Order::class);\n}\n","functional\u002Finvoices\u002Fsrc\u002FModels\u002FInvoice.php",[203,542,543,565,593,597,615,621,644],{"__ignoreMap":234},[238,544,545,547,549,551,554,556,559,561,563],{"class":240,"line":241},[238,546,412],{"class":411},[238,548,415],{"class":258},[238,550,419],{"class":418},[238,552,553],{"class":258},"Orders",[238,555,419],{"class":418},[238,557,558],{"class":258},"Models",[238,560,419],{"class":418},[238,562,532],{"class":258},[238,564,440],{"class":418},[238,566,567,569,571,573,576,578,581,583,586,588,591],{"class":240,"line":262},[238,568,412],{"class":411},[238,570,447],{"class":258},[238,572,419],{"class":418},[238,574,575],{"class":258},"Database",[238,577,419],{"class":418},[238,579,580],{"class":258},"Eloquent",[238,582,419],{"class":418},[238,584,585],{"class":258},"Relations",[238,587,419],{"class":418},[238,589,590],{"class":258},"BelongsTo",[238,592,440],{"class":418},[238,594,595],{"class":240,"line":270},[238,596,470],{"emptyLinePlaceholder":469},[238,598,599,603,606,609,612],{"class":240,"line":278},[238,600,602],{"class":601},"spNyl","public",[238,604,605],{"class":601}," function",[238,607,608],{"class":480}," order",[238,610,611],{"class":418},"():",[238,613,614],{"class":244}," BelongsTo\n",[238,616,618],{"class":240,"line":617},5,[238,619,620],{"class":418},"{\n",[238,622,624,628,631,634,636,638,640,642],{"class":240,"line":623},6,[238,625,627],{"class":626},"s7zQu","    return",[238,629,630],{"class":418}," $this->",[238,632,633],{"class":480},"belongsTo",[238,635,484],{"class":418},[238,637,532],{"class":244},[238,639,477],{"class":418},[238,641,502],{"class":411},[238,643,505],{"class":418},[238,645,647],{"class":240,"line":646},7,[238,648,649],{"class":418},"}\n",[224,651,653],{"id":652},"test-it","Test it",[229,655,657],{"className":231,"code":656,"language":233,"meta":234,"style":234},"php artisan osdd:test CreateInvoiceTest --layer=functional\u002Finvoices\nphp artisan osdd:phpunit\nphp artisan test --testsuite=functional\u002Finvoices\n",[203,658,659,673,682],{"__ignoreMap":234},[238,660,661,663,665,668,671],{"class":240,"line":241},[238,662,245],{"class":244},[238,664,249],{"class":248},[238,666,667],{"class":248}," osdd:test",[238,669,670],{"class":248}," CreateInvoiceTest",[238,672,366],{"class":248},[238,674,675,677,679],{"class":240,"line":262},[238,676,245],{"class":244},[238,678,249],{"class":248},[238,680,681],{"class":248}," osdd:phpunit\n",[238,683,684,686,688,691],{"class":240,"line":270},[238,685,245],{"class":244},[238,687,249],{"class":248},[238,689,690],{"class":248}," test",[238,692,693],{"class":248}," --testsuite=functional\u002Finvoices\n",[199,695,696,698,699,701,702,705,706,218],{},[203,697,134],{}," adds the ",[203,700,213],{}," test suite to ",[203,703,704],{},"phpunit.xml",". See ",[329,707,84],{"href":85},[224,709,711],{"id":710},"migrate-seed-and-check","Migrate, seed and check",[229,713,715],{"className":231,"code":714,"language":233,"meta":234,"style":234},"php artisan migrate\nphp artisan osdd:seed --layer=functional\u002Finvoices\nphp artisan osdd:check\n",[203,716,717,726,737],{"__ignoreMap":234},[238,718,719,721,723],{"class":240,"line":241},[238,720,245],{"class":244},[238,722,249],{"class":248},[238,724,725],{"class":248}," migrate\n",[238,727,728,730,732,735],{"class":240,"line":262},[238,729,245],{"class":244},[238,731,249],{"class":248},[238,733,734],{"class":248}," osdd:seed",[238,736,366],{"class":248},[238,738,739,741,743],{"class":240,"line":270},[238,740,245],{"class":244},[238,742,249],{"class":248},[238,744,745],{"class":248}," osdd:check\n",[747,748,749],"tip",{},[199,750,751,752,754],{},"Coding agents follow the same steps with the ",[329,753,176],{"href":177}," skill.",[756,757,758],"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 pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}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 .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 .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":234,"searchDepth":241,"depth":262,"links":760},[],"Take a new domain from an empty layer to a routed, authorized, seeded and tested resource.","md",null,{},{"title":56,"description":761},{"loc":57},"y6oOpaijWdYpbz9G6ywkNqZRBg4FfRreKuF-eMLL0EU",[769,771],{"title":46,"path":47,"stem":48,"description":770,"children":-1},"How each layer wires its migrations, seeders, routes, views and config through a provider of its own.",{"title":60,"path":61,"stem":62,"description":772,"children":-1},"Let one layer use another, move shared code to its own layer, and break cycles, while osdd:check stays green.",1794437210815]