Gates & Policies (Laravel)
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Gates dhe Policies vendosin kush lejohet të bëjë diçka: p.sh. vetëm autori mund ta ndryshojë postimin. Në Blade kontrollon me @can, në controller me $this->authorize().
EnglishEN
Gates and Policies decide who's allowed to do something: e.g. only the author can edit a post. In Blade you check with @can, in a controller with $this->authorize().
Si ta mendosh
Si rregullat e lejeve të dhëna nga drejtori.
Lexoje në anglisht
Like permission rules set by the head teacher.
Shembull kodiphp
class PostimPolicy {
public function update(User $u, Postim $p): bool { return $u->id === $p->user_id; }
}