[{"data":1,"prerenderedAt":877},["ShallowReactive",2],{"navigation":3,"\u002Fgetting-started\u002Fupgrade-guide":173,"\u002Fgetting-started\u002Fupgrade-guide-surround":872},[4,27,69,103,113,135],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":26},"Getting Started","i-heroicons-star","\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},"Upgrade guide","\u002Fgetting-started\u002Fupgrade-guide","1.getting-started\u002F5.upgrade-guide",false,{"title":28,"icon":29,"path":30,"stem":31,"children":32,"page":26},"Essentials","i-heroicons-shield-check","\u002Fessentials","2.essentials",[33,37,41,45,49,53,57,61,65],{"title":34,"path":35,"stem":36},"Controls","\u002Fessentials\u002Fcontrols","2.essentials\u002F1.controls",{"title":38,"path":39,"stem":40},"Perimeters","\u002Fessentials\u002Fperimeters","2.essentials\u002F2.perimeters",{"title":42,"path":43,"stem":44},"Perimeter classes","\u002Fessentials\u002Fperimeter-classes","2.essentials\u002F3.perimeter-classes",{"title":46,"path":47,"stem":48},"Levels","\u002Fessentials\u002Flevels","2.essentials\u002F4.levels",{"title":50,"path":51,"stem":52},"Boundaries","\u002Fessentials\u002Fboundaries","2.essentials\u002F5.boundaries",{"title":54,"path":55,"stem":56},"Parents","\u002Fessentials\u002Fparents","2.essentials\u002F6.parents",{"title":58,"path":59,"stem":60},"Policies","\u002Fessentials\u002Fpolicies","2.essentials\u002F7.policies",{"title":62,"path":63,"stem":64},"Queries","\u002Fessentials\u002Fqueries","2.essentials\u002F8.queries",{"title":66,"path":67,"stem":68},"Readers","\u002Fessentials\u002Freaders","2.essentials\u002F9.readers",{"title":70,"icon":71,"path":72,"stem":73,"children":74,"page":26},"Search","i-heroicons-magnifying-glass","\u002Fsearch","3.search",[75,79,83,87,91,95,99],{"title":76,"path":77,"stem":78},"Search overview","\u002Fsearch\u002Foverview","3.search\u002F1.overview",{"title":80,"path":81,"stem":82},"Engines","\u002Fsearch\u002Fengines","3.search\u002F2.engines",{"title":84,"path":85,"stem":86},"Keeping the keys fresh","\u002Fsearch\u002Fkeeping-the-keys-fresh","3.search\u002F3.keeping-the-keys-fresh",{"title":88,"path":89,"stem":90},"Exceptions and dates","\u002Fsearch\u002Fexceptions-and-dates","3.search\u002F4.exceptions-and-dates",{"title":92,"path":93,"stem":94},"Searching through a parent","\u002Fsearch\u002Fthrough-a-parent","3.search\u002F5.through-a-parent",{"title":96,"path":97,"stem":98},"Search from the browser","\u002Fsearch\u002Ffrom-the-browser","3.search\u002F6.from-the-browser",{"title":100,"path":101,"stem":102},"Your own search client","\u002Fsearch\u002Fyour-own-client","3.search\u002F7.your-own-client",{"title":104,"icon":105,"path":106,"stem":107,"children":108,"page":26},"Integrations","i-heroicons-puzzle-piece","\u002Fintegrations","4.integrations",[109],{"title":110,"path":111,"stem":112},"laravel-rest-api","\u002Fintegrations\u002Flaravel-rest-api","4.integrations\u002F1.laravel-rest-api",{"title":114,"icon":115,"path":116,"stem":117,"children":118,"page":26},"Testing and Tooling","i-heroicons-wrench-screwdriver","\u002Ftesting-and-tooling","5.testing-and-tooling",[119,123,127,131],{"title":120,"path":121,"stem":122},"Testing","\u002Ftesting-and-tooling\u002Ftesting","5.testing-and-tooling\u002F1.testing",{"title":124,"path":125,"stem":126},"access:check","\u002Ftesting-and-tooling\u002Faccess-check","5.testing-and-tooling\u002F2.access-check",{"title":128,"path":129,"stem":130},"Cache and about","\u002Ftesting-and-tooling\u002Fcache-and-about","5.testing-and-tooling\u002F3.cache-and-about",{"title":132,"path":133,"stem":134},"Generators","\u002Ftesting-and-tooling\u002Fgenerators","5.testing-and-tooling\u002F4.generators",{"title":136,"icon":137,"path":138,"stem":139,"children":140,"page":26},"Digging Deeper","i-heroicons-list-bullet","\u002Fdigging-deeper","6.digging-deeper",[141,145,149,153,157,161,165,169],{"title":142,"path":143,"stem":144},"Abilities","\u002Fdigging-deeper\u002Fabilities","6.digging-deeper\u002F1.abilities",{"title":146,"path":147,"stem":148},"Kept decisions","\u002Fdigging-deeper\u002Fdecisions","6.digging-deeper\u002F2.decisions",{"title":150,"path":151,"stem":152},"Batched decisions","\u002Fdigging-deeper\u002Fbatched-decisions","6.digging-deeper\u002F3.batched-decisions",{"title":154,"path":155,"stem":156},"Row checks","\u002Fdigging-deeper\u002Frow-checks","6.digging-deeper\u002F4.row-checks",{"title":158,"path":159,"stem":160},"Several brands","\u002Fdigging-deeper\u002Fseveral-brands","6.digging-deeper\u002F5.several-brands",{"title":162,"path":163,"stem":164},"Row context","\u002Fdigging-deeper\u002Frow-context","6.digging-deeper\u002F6.row-context",{"title":166,"path":167,"stem":168},"What is public in 1.x","\u002Fdigging-deeper\u002Fpublic-api","6.digging-deeper\u002F7.public-api",{"title":170,"path":171,"stem":172},"Use with AI","\u002Fdigging-deeper\u002Fuse-with-ai","6.digging-deeper\u002F8.use-with-ai",{"id":174,"title":23,"body":175,"description":863,"extension":864,"links":865,"meta":866,"navigation":867,"path":24,"seo":868,"sitemap":869,"stem":25,"updatedAt":870,"__hash__":871},"docs\u002F1.getting-started\u002F5.upgrade-guide.md",{"type":176,"value":177,"toc":846},"minimark",[178,183,195,204,209,217,221,353,356,381,406,409,515,519,562,565,675,678,774,776,796,800],[179,180,182],"h2",{"id":181},"upgrading-to-10-from-0x","Upgrading to 1.0 from 0.x",[184,185,186,187,194],"p",{},"Version 1.0 requires PHP 8.3 and Laravel 13. Applications that stay on Laravel 12 can use version ",[188,189,193],"a",{"href":190,"rel":191},"https:\u002F\u002Fgithub.com\u002FLomkit\u002Flaravel-access-control\u002Freleases\u002Ftag\u002Fv0.7.0",[192],"nofollow","0.7",", the last 0.x release.",[184,196,197,198,203],{},"This page sums up the main changes, area by area, each with the page that explains the new way. The ",[188,199,202],{"href":200,"rel":201},"https:\u002F\u002Fgithub.com\u002FLomkit\u002Flaravel-access-control\u002Fblob\u002F1.x\u002FUPGRADE.md",[192],"upgrade guide on GitHub"," lists every breaking change, with before and after examples, and ends with a table that maps each removed call to its replacement. Go through the sections of the features that your application uses.",[205,206,208],"h3",{"id":207},"coming-from-06","Coming from 0.6",[184,210,211,212,216],{},"Version 0.7 already changed several things. If you upgrade from 0.6, apply the ",[188,213,215],{"href":190,"rel":214},[192],"0.7.0 checklist"," first, then the 1.0 guide.",[179,218,220],{"id":219},"configuration-and-controls","Configuration and controls",[222,223,224,251,290,322,337],"ul",{},[225,226,227,231,232,236,237,240,241,243,244,250],"li",{},[228,229,230],"strong",{},"No configuration file."," ",[233,234,235],"code",{},"config\u002Faccess-control.php"," and its ",[233,238,239],{},"methods"," map are gone: delete your published file. A custom ",[233,242,239],{}," map becomes an override of ",[188,245,247],{"href":246},"\u002Fessentials\u002Fpolicies#abilities",[233,248,249],{},"abilityFor()"," on the control.",[225,252,253,256,257,261,262,265,266,269,270,273,274,277,278,281,282,285,286,289],{},[228,254,255],{},"Linking a model."," A control is ",[188,258,260],{"href":259},"\u002Fessentials\u002Fcontrols#discovery","discovered"," in ",[233,263,264],{},"app\u002FAccess\u002FControls"," by its ",[233,267,268],{},"$model",", or named on the model with ",[233,271,272],{},"#[ControlledBy]",". ",[233,275,276],{},"addControl()",", ",[233,279,280],{},"addControls()"," and ",[233,283,284],{},"Access::$controlDiscoveryPaths"," are replaced by the attribute and ",[233,287,288],{},"Access::discoverControlsIn()",", which adds directories.",[225,291,292,231,299,302,303,309,310,313,314,317,318,321],{},[228,293,294,295,298],{},"The ",[233,296,297],{},"Access"," facade.",[233,300,301],{},"Access::controlForModel()"," becomes ",[188,304,306],{"href":305},"\u002Fessentials\u002Fcontrols#the-access-facade",[233,307,308],{},"Access::controlFor()",", which throws ",[233,311,312],{},"MissingControlException",", with ",[233,315,316],{},"Access::hasControl()"," to check first. ",[233,319,320],{},"Access::flush()"," is removed.",[225,323,324,327,328,331,332,336],{},[228,325,326],{},"Pure perimeter lists."," A control builds its perimeters once per process: read the user and the request in the callbacks, never in ",[233,329,330],{},"perimeters()",". See ",[188,333,335],{"href":334},"\u002Fessentials\u002Fcontrols#pure-perimeter-lists","Pure perimeter lists",".",[225,338,339,342,343,346,347,350,351,336],{},[228,340,341],{},"Cache."," Run ",[233,344,345],{},"php artisan access:cache"," again after upgrading, or ",[233,348,349],{},"php artisan optimize"," in your deployment. See ",[188,352,128],{"href":129},[179,354,62],{"id":355},"queries",[357,358,359],"warning",{},[184,360,361,231,364,367,368,371,372,375,376,378,379,336],{},[228,362,363],{},"A query is controlled only when it says so.",[233,365,366],{},"queries.enabled_by_default"," is gone: plain queries, relations, ",[233,369,370],{},"whereHas()"," subqueries, eager and lazy loads and route model binding now read every row unless they call ",[233,373,374],{},"controlled()",". Add ",[233,377,374],{}," to every query that must be filtered, and authorize a model bound to a route through its policy. See ",[188,380,62],{"href":63},[222,382,383,392],{},[225,384,385,281,388,391],{},[233,386,387],{},"controlled('update')",[233,389,390],{},"controlledFor($user, 'approve')"," list the rows of another ability.",[225,393,394,277,397,281,400,403,404,336],{},[233,395,396],{},"withAbilities()",[233,398,399],{},"Access::preload()",[233,401,402],{},"reachableKeys()"," replace the helpers that collected the editable keys. See ",[188,405,150],{"href":151},[179,407,38],{"id":408},"perimeters",[222,410,411,433,455,468,484,509],{},[225,412,413,231,416,419,420,425,426,429,430,336],{},[228,414,415],{},"Abilities.",[233,417,418],{},"allowed()"," receives an ",[188,421,422],{"href":143},[233,423,424],{},"Ability"," instead of a string: type the parameter ",[233,427,428],{},"Ability $ability"," and compare with ",[233,431,432],{},"$ability->is('update')",[225,434,435,438,439,442,443,446,447,449,450,452,453,336],{},[228,436,437],{},"Callbacks."," A ",[233,440,441],{},"query()"," callback constrains the builder it receives, and an empty or joined one throws. A perimeter without ",[233,444,445],{},"should()"," checks a saved row in SQL through its ",[233,448,441],{},": remove the ",[233,451,445],{}," callbacks that only repeated it, and keep those of the perimeters through which users create rows. See ",[188,454,38],{"href":39},[225,456,457,460,461,331,464,336],{},[228,458,459],{},"Every row."," A global perimeter becomes ",[233,462,463],{},"unrestricted()",[188,465,467],{"href":466},"\u002Fessentials\u002Fperimeters#unrestricted-perimeters","Unrestricted perimeters",[225,469,470,473,474,479,480,483],{},[228,471,472],{},"Combining."," Perimeters that stopped at the first allowed one become a ",[188,475,476],{"href":47},[233,477,478],{},"Levels::of()"," group, widest first, and ",[233,481,482],{},"OverlayPerimeter"," becomes a plain perimeter outside the group.",[225,485,486,489,490,493,494,277,497,281,500,503,504,331,507,336],{},[228,487,488],{},"Classes."," The overridden ",[233,491,492],{},"apply*Callback()"," methods become the protected hooks ",[233,495,496],{},"allows()",[233,498,499],{},"includes()",[233,501,502],{},"scope()",", which receive an ",[233,505,506],{},"AccessContext",[188,508,42],{"href":43},[225,510,511,514],{},[228,512,513],{},"Immutable."," Each fluent method returns a new perimeter, and a second declaration of a callback throws.",[179,516,518],{"id":517},"boundaries-and-parents","Boundaries and parents",[222,520,521,540],{},[225,522,523,526,527,530,531,534,535,250],{},[228,524,525],{},"Boundaries."," A condition that every row must meet, such as the tenant, moves from an override of ",[233,528,529],{},"applies()"," or ",[233,532,533],{},"applyQueryControl()"," to ",[188,536,537],{"href":51},[233,538,539],{},"boundary()",[225,541,542,545,546,548,549,551,552,557,558,561],{},[228,543,544],{},"Parents."," A child whose ",[233,547,441],{}," called ",[233,550,370],{}," on its parent becomes a ",[188,553,554],{"href":55},[233,555,556],{},"ThroughParent",", which delegates only ",[233,559,560],{},"view"," by default.",[179,563,58],{"id":564},"policies",[222,566,567,583,601,623,647,660],{},[225,568,569,572,573,576,577,336],{},[228,570,571],{},"Automatic policies."," An empty ",[233,574,575],{},"ControlledPolicy"," subclass is replaced by ",[188,578,580],{"href":579},"\u002Fessentials\u002Fpolicies#automatic-policies",[233,581,582],{},"Access::registerPolicies()",[225,584,585,588,589,592,593,597,598,336],{},[228,586,587],{},"Responses."," The policy methods return a ",[233,590,591],{},"Response"," with a ",[188,594,596],{"href":595},"\u002Fessentials\u002Fpolicies#refusals","refusal code",", and a row of another tenant answers ",[233,599,600],{},"404",[225,602,603,606,607,610,611,614,615,618,619,336],{},[228,604,605],{},"Drafts."," Authorize a creation with the model about to be created: ",[233,608,609],{},"authorize('create', [Post::class, $draft])",". An overridden ",[233,612,613],{},"create()"," takes ",[233,616,617],{},"create(Model $user, ?Model $draft = null): Response",", or PHP throws a fatal error. See ",[188,620,622],{"href":621},"\u002Fessentials\u002Fpolicies#drafts","Drafts",[225,624,625,628,629,632,633,636,637,281,640,331,643,336],{},[228,626,627],{},"Stored values."," The policy decides a saved row on its stored values: a row changed with ",[233,630,631],{},"fill()"," is decided on what the database holds, so check new values through a draft. A model that is not saved is refused with ",[233,634,635],{},"unsaved",", for every ability but ",[233,638,639],{},"viewAny",[233,641,642],{},"create",[188,644,646],{"href":645},"\u002Fessentials\u002Fpolicies#decisions-on-the-stored-row","Decisions on the stored row",[225,648,649,652,653,331,656,336],{},[228,650,651],{},"Business abilities."," A method that called the control by hand calls ",[233,654,655],{},"decideByControl()",[188,657,659],{"href":658},"\u002Fessentials\u002Fpolicies#business-abilities","Business abilities",[225,661,662,665,666,668,669,336],{},[228,663,664],{},"Decision context."," What ",[233,667,418],{}," reads besides the reader, such as the current team, goes in ",[188,670,672],{"href":671},"\u002Fessentials\u002Freaders#the-decision-context",[233,673,674],{},"Access::decisionContextUsing()",[179,676,70],{"id":677},"search",[222,679,680,702,721,743,759],{},[225,681,682,231,685,302,688,691,692,277,694,530,697,331,700,336],{},[228,683,684],{},"The model.",[233,686,687],{},"Searchable",[233,689,690],{},"ControlledSearchable",", and every search says ",[233,693,374],{},[233,695,696],{},"controlledFor()",[233,698,699],{},"uncontrolled()",[188,701,76],{"href":77},[225,703,704,231,707,281,710,713,714,720],{},[228,705,706],{},"Search keys.",[233,708,709],{},"scoutQuery()",[233,711,712],{},"scoutScope()"," are replaced by ",[188,715,717],{"href":716},"\u002Fsearch\u002Foverview#search-keys",[233,718,719],{},"searchKeys()",". A controlled search now gives the union of the perimeters, with the boundary.",[225,722,723,726,727,281,730,733,734,737,738,331,741,336],{},[228,724,725],{},"Engines."," Declare ",[233,728,729],{},"_access",[233,731,732],{},"_boundary"," as filterable, then reindex every controlled model. The ",[233,735,736],{},"collection"," engine is refused: use ",[233,739,740],{},"database",[188,742,80],{"href":81},[225,744,745,748,749,752,753,756,757,336],{},[228,746,747],{},"Freshness."," A listener that reindexed documents becomes ",[233,750,751],{},"reindexWhen()"," or the ",[233,754,755],{},"ReindexesSearch"," pivot trait. See ",[188,758,84],{"href":85},[225,760,761,764,765,768,769,331,772,336],{},[228,762,763],{},"Browser search."," A token whose filter was written by hand becomes ",[233,766,767],{},"Access::searchToken()",", or a route that calls ",[233,770,771],{},"Access::guardSearch()",[188,773,96],{"href":97},[179,775,110],{"id":110},[222,777,778,781],{},[225,779,780],{},"An application that uses laravel-rest-api upgrades it to 3.6 or later first: 1.0 conflicts with earlier versions, so Composer refuses the upgrade until then.",[225,782,783,786,787,281,790,793,794,336],{},[233,784,785],{},"AccessControlExtension"," restricts the rows, filters the text searches and preloads the row checks of every controlled resource: remove the ",[233,788,789],{},"perimeterQuery()",[233,791,792],{},"prepareAuthorization()"," overrides that applied the control. See ",[188,795,110],{"href":111},[179,797,799],{"id":798},"testing-and-tooling","Testing and tooling",[222,801,802,813,835],{},[225,803,804,342,807,812],{},[228,805,806],{},"Checks.",[188,808,809],{"href":125},[233,810,811],{},"php artisan access:check"," in CI, with the Scout driver of production.",[225,814,815,818,819,822,823,825,826,829,830,832,833,336],{},[228,816,817],{},"Assertions."," A test that compared ",[233,820,821],{},"can()"," with ",[233,824,374],{}," by hand becomes ",[233,827,828],{},"assertControlAgrees()",". Remove the ",[233,831,320],{}," calls: each test gets a new registry. See ",[188,834,120],{"href":121},[225,836,837,231,840,843,844,336],{},[228,838,839],{},"Generators.",[233,841,842],{},"make:perimeter --overlay"," is removed. Publish your stubs again if you published them. See ",[188,845,132],{"href":133},{"title":847,"searchDepth":848,"depth":849,"links":850},"",1,2,[851,855,856,857,858,859,860,861,862],{"id":181,"depth":849,"text":182,"children":852},[853],{"id":207,"depth":854,"text":208},3,{"id":219,"depth":849,"text":220},{"id":355,"depth":849,"text":62},{"id":408,"depth":849,"text":38},{"id":517,"depth":849,"text":518},{"id":564,"depth":849,"text":58},{"id":677,"depth":849,"text":70},{"id":110,"depth":849,"text":110},{"id":798,"depth":849,"text":799},"Move an application from Laravel Access Control 0.x to 1.0, area by area, with a link to the page that explains each new way.","md",null,{},true,{"title":23,"description":863},{"loc":24,"lastmod":870},"2026-11-21T15:24:08+01:00","A9p8kZbCSapcIpfSKgF0Y_ENcjDKseK6jHgz3tYmeZo",[873,875],{"title":19,"path":20,"stem":21,"description":874,"children":-1},"Control your first model in four steps, from the perimeter classes to the policy and the controlled queries.",{"title":34,"path":35,"stem":36,"description":876,"children":-1},"A control declares the access to one Eloquent model. Learn how to write one, how the package finds it, and how to link it to its model.",1795277180650]