{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "marcreichel-laya-php--gate-user-content-in-forms",
 "repo": "marcreichel/laya-php",
 "repo_url": "https://github.com/marcreichel/laya-php",
 "repo_slug": "marcreichel-laya-php",
 "title": "Block abusive or spam text in Laravel form submissions",
 "page_title": "How to block abusive or spam text in Laravel form submissions with Laya PHP",
 "summary": "Add a validation rule that asks a yes/no question about each submitted text and rejects the bad ones.",
 "who": "A Laravel developer who accepts reviews, comments or messages from users and wants a moderation check on the server.",
 "problem": "Free-text fields let in insults, spam and threats, and reviewing every submission by hand does not scale.",
 "outcome": "Form submissions that answer yes to the moderation question fail validation with a friendly message, and the others pass.",
 "steps": [
  "Run `composer require marcreichel/laya-php` in your Laravel app.",
  "Start laya-serve with `docker compose up -d --wait` from a clone of this repo and confirm it with `php artisan laya:health`.",
  "Add `Decides::not('Does the text contain insults, hate speech or threats?')` to the rule list for the text field in your `$request->validate()` call.",
  "Set your own `validation.laya` message if the default one does not fit your app.",
  "Test the form with `Laya::fake(['answer' => true])` so the rule fails without a running server. (inferred, check the README)"
 ],
 "agent_prompt": "In the marcreichel/laya-php repo's Laravel setup, add a Decides::not rule with the question <moderation question> to the <form field> validation in <controller or form request>. Report which test inputs pass and fail, and verify that a request with a fake answer of true is rejected.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "45 minutes",
 "basis": "readme",
 "caveat": "If laya-serve is unreachable or busy, the rule fails validation unless you add passWhenUnavailable(), so plan for that case.",
 "category": "Work and operations",
 "tags": [
  "Work and operations"
 ],
 "lang": "php",
 "requirements": [
  "PHP 8.4+ and Composer",
  "A PSR-18 HTTP client such as Guzzle or Symfony HttpClient",
  "Docker, to run laya-serve from the repo's compose.yaml",
  "Laravel 13+ for the Laravel steps (service provider, artisan commands, validation rule, cast)"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/marcreichel-laya-php/gate-user-content-in-forms/",
 "md": "https://dedupedai.com/use-cases/marcreichel-laya-php/gate-user-content-in-forms/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/marcreichel-laya-php--gate-user-content-in-forms.json",
 "api_version": "v1"
}
