[{"data":1,"prerenderedAt":699},["ShallowReactive",2],{"navigation":3,"\u002Fdigging-deeper\u002Fdecisions":173,"\u002Fdigging-deeper\u002Fdecisions-surround":694},[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":146,"body":175,"description":686,"extension":687,"links":688,"meta":689,"navigation":602,"path":147,"seo":690,"sitemap":691,"stem":148,"updatedAt":692,"__hash__":693},"docs\u002F6.digging-deeper\u002F2.decisions.md",{"type":176,"value":177,"toc":675},"minimark",[178,197,202,205,241,263,266,270,273,294,363,367,370,430,453,480,487,493,518,521,526,532,617,634,637,648,652,661,671],[179,180,181,182,186,187,192,193,196],"p",{},"Within a request, a queued job or a console command, the package keeps what it decided, so that an ",[183,184,185],"code",{},"allowed()"," that queries runs once per reader, ability and ",[188,189,191],"a",{"href":190},"\u002Fessentials\u002Freaders#the-decision-context","decision context",", not once per row. The ",[188,194,66],{"href":195},"\u002Fessentials\u002Freaders#kept-decisions"," page gives the essentials; this page gives the details.",[198,199,201],"h2",{"id":200},"what-is-kept","What is kept",[179,203,204],{},"Two kinds of answers, each capped at 10,000 entries, the oldest dropped first:",[206,207,208,231],"ul",{},[209,210,211,215,216,218,219,222,223,226,227,230],"li",{},[212,213,214],"strong",{},"The perimeters a reader reaches",", under the reader (its morph class, connection and key), the decision context, the control and the ability: what every ",[183,217,185],{}," callback and ",[183,220,221],{},"allows()"," hook answered, what the boundary's ",[183,224,225],{},"admits()"," answered, the level reached in each group, and, for a ",[183,228,229],{},"ThroughParent",", the perimeters the reader reaches on the parent, kept the same way under the parent's control.",[209,232,233,236,237,240],{},[212,234,235],{},"The SQL check of each row",", under the reader, the decision context, the model, the key of the row and the ability. The ",[188,238,239],{"href":151},"batched decisions"," fill it too.",[179,242,243,244,247,248,251,252,255,256,247,259,262],{},"The policy, ",[183,245,246],{},"controlled()",", ",[183,249,250],{},"controlledFor()",", the batches, the search filter and ",[183,253,254],{},"applicablePerimeters()"," read the same kept perimeters, so they always agree within a request. The in-memory checks, ",[183,257,258],{},"should()",[183,260,261],{},"includes()"," and the in-memory form of the boundary, run on every decision, on the row as stored.",[179,264,265],{},"A reader without a key, or not saved, is never kept: its perimeters are evaluated again on every decision.",[198,267,269],{"id":268},"what-forgets-them","What forgets them",[179,271,272],{},"Everything kept is forgotten at once:",[206,274,275,278,281,284,287],{},[209,276,277],{},"after any SQL statement that is not a read, on any connection;",[209,279,280],{},"when a transaction rolls back;",[209,282,283],{},"once Laravel has handled a request, so two requests of one test share nothing;",[209,285,286],{},"at the end of each queued job;",[209,288,289,290,293],{},"when the application calls ",[183,291,292],{},"Access::forgetDecisions()",".",[179,295,296,297,300,301,304,305,308,309,247,312,315,316,319,320,247,323,326,327,247,330,247,333,326,336,339,340,247,343,247,346,247,349,247,352,355,356,358,359,362],{},"A ",[212,298,299],{},"read"," is a single statement that starts with ",[183,302,303],{},"select"," or ",[183,306,307],{},"show",", after spaces and opening parentheses. Every other statement forgets: Eloquent saves and deletes, with or without events (",[183,310,311],{},"saveQuietly()",[183,313,314],{},"withoutEvents()",", and ",[183,317,318],{},"Event::fake()"," on a connection opened before it), mass updates and deletes, ",[183,321,322],{},"attach()",[183,324,325],{},"detach()"," and ",[183,328,329],{},"sync()",[183,331,332],{},"DB::table()",[183,334,335],{},"DB::statement()",[183,337,338],{},"DB::unprepared()",". So do the statements that might write without starting with a write: ",[183,341,342],{},"with",[183,344,345],{},"explain",[183,347,348],{},"pragma",[183,350,351],{},"call",[183,353,354],{},"set",", a statement that starts with a comment, the schema statements, and a ",[183,357,303],{}," followed by ",[183,360,361],{},";"," and another statement.",[198,364,366],{"id":365},"laravels-own-tables","Laravel's own tables",[179,368,369],{},"The writes that Laravel makes to its own tables do not forget, so a cache entry, a lock, the rate limiter, a session or a queued job costs no query in production, where these drivers write to the database:",[206,371,372,391,403,410,421],{},[209,373,374,375,378,379,382,383,386,387,390],{},"the ",[183,376,377],{},"table"," of each cache store whose driver is ",[183,380,381],{},"database",", and its ",[183,384,385],{},"lock_table"," (",[183,388,389],{},"cache_locks"," when unset);",[209,392,393,396,397,400,401,361],{},[183,394,395],{},"session.table",", when ",[183,398,399],{},"session.driver"," is ",[183,402,381],{},[209,404,374,405,407,408,361],{},[183,406,377],{}," of each queue connection whose driver is ",[183,409,381],{},[209,411,412,415,416,304,418,361],{},[183,413,414],{},"queue.failed.table",", when its driver is ",[183,417,381],{},[183,419,420],{},"database-uuids",[209,422,423,386,426,429],{},[183,424,425],{},"queue.batching.table",[183,427,428],{},"job_batches"," when unset), unless batching uses DynamoDB.",[179,431,432,433,436,437,440,441,444,445,448,449,452],{},"The package reads them from the configuration, each on the connection it names, the default one when it is ",[183,434,435],{},"null",". A write is one of them only when it is a single ",[183,438,439],{},"insert",", upsert, ",[183,442,443],{},"update"," that reads no other table, ",[183,446,447],{},"delete"," or SQL Server ",[183,450,451],{},"merge"," on one of these tables, quoted the way the query builder quotes it.",[206,454,455,470],{},[209,456,457,458,461,462,465,466,469],{},"An application table with the name and the connection of one of them, such as a ",[183,459,460],{},"Job"," model on the ",[183,463,464],{},"jobs"," table that ",[183,467,468],{},"config\u002Fqueue.php"," declares, never forgets: give it another name or connection.",[209,471,472,473,247,476,479],{},"The list cannot be extended. Write a log of each row after the response (",[183,474,475],{},"defer()",[183,477,478],{},"dispatch()->afterResponse()","), not while the page renders: each write would forget the batched decisions of the page.",[198,481,483,484],{"id":482},"calling-forgetdecisions","Calling ",[183,485,486],{},"forgetDecisions()",[179,488,489,490,492],{},"Call ",[183,491,292],{}," when a decision changes without a write through a Laravel connection:",[206,494,495,498,501,511],{},[209,496,497],{},"a write through another PDO handle, or a database client outside Laravel;",[209,499,500],{},"a write by another process, such as a queue worker, a scheduled command or another application, that the current request or job must see;",[209,502,503,504,506,507,510],{},"a write hidden in a statement read as a ",[183,505,303],{},", such as a function that writes, or ",[183,508,509],{},"select ... into"," in PostgreSQL and SQL Server;",[209,512,513,514,517],{},"a permission changed without any write, such as a ",[183,515,516],{},"Gate::define()"," in a test.",[179,519,520],{},"A statement that fails after writing part of its rows does not forget. An attribute of the reader changed in memory, without saving it, does not change what was kept either.",[522,523,525],"h3",{"id":524},"long-console-commands","Long console commands",[179,527,528,529,531],{},"A console command keeps its decisions for its whole run, and never sees a permission revoked by another process. Call ",[183,530,292],{}," at the start of each unit of work:",[533,534,539],"pre",{"className":535,"code":536,"language":537,"meta":538,"style":538},"language-php shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","foreach (Tenant::all() as $tenant) {\n    Access::forgetDecisions();\n\n    \u002F\u002F ...\n}\n","php","",[183,540,541,583,597,604,611],{"__ignoreMap":538},[542,543,546,550,553,557,560,564,567,570,573,577,580],"span",{"class":544,"line":545},"line",1,[542,547,549],{"class":548},"s7zQu","foreach",[542,551,386],{"class":552},"sMK4o",[542,554,556],{"class":555},"sBMFI","Tenant",[542,558,559],{"class":552},"::",[542,561,563],{"class":562},"s2Zo4","all",[542,565,566],{"class":552},"()",[542,568,569],{"class":552}," as",[542,571,572],{"class":552}," $",[542,574,576],{"class":575},"sTEyZ","tenant",[542,578,579],{"class":552},")",[542,581,582],{"class":552}," {\n",[542,584,586,589,591,594],{"class":544,"line":585},2,[542,587,588],{"class":555},"    Access",[542,590,559],{"class":552},[542,592,593],{"class":562},"forgetDecisions",[542,595,596],{"class":552},"();\n",[542,598,600],{"class":544,"line":599},3,[542,601,603],{"emptyLinePlaceholder":602},true,"\n",[542,605,607],{"class":544,"line":606},4,[542,608,610],{"class":609},"sHwdD","    \u002F\u002F ...\n",[542,612,614],{"class":544,"line":613},5,[542,615,616],{"class":552},"}\n",[179,618,619,620,622,623,626,627,630,631,633],{},"The same goes for a right on a period: an ",[183,621,185],{}," that compares with ",[183,624,625],{},"now()",", and the SQL check of a row through a ",[183,628,629],{},"query()"," that does, keep the answer of the instant they ran. The lists still run ",[183,632,629],{}," at each call, and the searches compute the reader keys at each call.",[522,635,636],{"id":464},"Jobs",[179,638,639,640,643,644,647],{},"A queue worker starts each job with no kept decision. A job run with the ",[183,641,642],{},"sync"," connection or ",[183,645,646],{},"dispatchSync()"," shares the kept decisions of the request that runs it.",[198,649,651],{"id":650},"the-decision-context","The decision context",[179,653,654,655,657,658,660],{},"Everything that ",[183,656,185],{}," reads besides the reader belongs in the ",[188,659,191],{"href":190},": the current team of a permission package, a tenant or a guard set during the request. A value that changes without being in it reuses the answer given for the previous value until the next flush.",[179,662,663,664,667,668,293],{},"laravel-rest-api files the decisions that ",[183,665,666],{},"authorizationCache()"," keeps under the same context: see ",[188,669,110],{"href":670},"\u002Fintegrations\u002Flaravel-rest-api#kept-decisions",[672,673,674],"style",{},"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}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 .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}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);}",{"title":538,"searchDepth":545,"depth":585,"links":676},[677,678,679,680,685],{"id":200,"depth":585,"text":201},{"id":268,"depth":585,"text":269},{"id":365,"depth":585,"text":366},{"id":482,"depth":585,"text":681,"children":682},"Calling forgetDecisions()",[683,684],{"id":524,"depth":599,"text":525},{"id":464,"depth":599,"text":636},{"id":650,"depth":585,"text":651},"What the package keeps within a request or a job, what forgets it, the writes of Laravel's own tables that do not, and when to call Access::forgetDecisions().","md",null,{},{"title":146,"description":686},{"loc":147,"lastmod":692},"2026-11-21T15:24:08+01:00","XHsFJ92IdPK_yKCX00-Gc6qQgXMBsAw7qyvUtxvelu0",[695,697],{"title":142,"path":143,"stem":144,"description":696,"children":-1},"The Ability value object names what a reader wants to do: how a policy method maps to an ability, how to change the mapping, and how business abilities work.",{"title":150,"path":151,"stem":152,"description":698,"children":-1},"Decide the rows of a page in one query with withAbilities(), preload decisions with Access::preload(), or get the keys a reader may act on with reachableKeys().",1795277182210]