2.2 KiB
2.2 KiB
Repository Guidelines
Project Structure & Module Organization
app/contains application logic (controllers, models, services).resources/views/stores Blade templates for public pages and admin UI.routes/web.phpdefines frontend/admin routes.database/migrations/contains schema and data migration files.tests/Feature/andtests/Unit/hold feature and unit tests.public/serves static assets; uploaded files are exposed viapublic/storage.
Build, Test, and Development Commands
composer installinstalls PHP dependencies.npm installinstalls frontend dependencies.composer run devstarts local Laravel + Vite development workflow.php artisan migrateruns database migrations.composer testclears config and runs test suite.php artisan storage:linkcreates the/storagepublic symlink for uploads.
Coding Style & Naming Conventions
- Follow PSR-12 for PHP; use 4-space indentation.
- Use strict types (
declare(strict_types=1);) in PHP files. - Class names:
PascalCase; methods/variables:camelCase; constants:UPPER_SNAKE_CASE. - Blade components should be reusable and grouped by domain (e.g.
resources/views/components/portal/). - Keep controller actions focused; extract reusable logic to private methods/services.
Testing Guidelines
- Write unit tests for pure logic in
tests/Unit/. - Write feature tests for routes/forms/permissions in
tests/Feature/. - Name tests by behavior, e.g.
test_admin_can_update_home_modules. - Run
composer testbefore opening a PR.
Commit & Pull Request Guidelines
- Use clear, scoped commit messages, e.g.
feat(admin): add structured home module settings. - Keep commits focused; avoid mixing unrelated refactors.
- PRs should include:
- What changed and why
- Screenshots/GIFs for UI updates
- Migration/rollback notes if schema changes
- Test coverage notes or manual verification steps
Security & Configuration Tips
- Never commit
.envor secrets. - Ensure
APP_URLis correct in each environment. - For markdown/image uploads, prefer relative
/storage/...paths to avoid host lock-in. - Validate all admin inputs (URL type, route whitelist, required fields) before persistence.