Files
knowledge_base/README.md
Yutaka Kurosaki 6e7f8566ef Implement ID-based routing and folder auto-generation from titles
Major features:
- Switch from slug-based to ID-based routing (/documents/123)
- Enable title editing with automatic slug/path regeneration
- Auto-generate folder structure from title slashes (e.g., Laravel/Livewire/Components)
- Persist sidebar folder open/close state using localStorage
- Remove slug unique constraint (ID routing makes it unnecessary)
- Implement recursive tree view with multi-level folder support

Architecture changes:
- DocumentService: Add generatePathAndSlug() for title-based path generation
- Routes: Change from {document:slug} to {document} for ID binding
- SidebarTree: Extract recursive rendering to partials/tree-item.blade.php
- Database: Remove unique constraint from documents.slug column

UI improvements:
- Display only last path component in sidebar (Components vs Laravel/Livewire/Components)
- Folder state persists across page navigation via localStorage
- Title field accepts slashes for folder organization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 09:41:38 +09:00

143 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Laravel Docker環境
Nginx + PHP + Laravel + MySQL + PhpMyAdmin + MailHog を使ったDocker開発環境です。
## 構成
- **Nginx**: Webサーバーポート: 9700
- **PHP 8.2**: PHP-FPM + Composer + Node.js
- **MySQL 8.0**: データベース(ポート: 9702
- **PhpMyAdmin**: DB管理ツールポート: 9701
- **MailHog**: メールテストツールSMTP: 1025, Web UI: 9725
## ディレクトリ構成
```
.
├── docker/
│ ├── nginx/
│ │ └── default.conf
│ ├── php/
│ │ ├── Dockerfile
│ │ └── php.ini
│ └── mysql/
│ └── my.cnf
├── src/
│ └── (Laravelプロジェクト)
├── .env
├── .gitignore
└── docker-compose.yml
```
## セットアップ手順
### 1. Laravelプロジェクトのインストール
srcフォルダにLaravelをインストールします
```bash
# Dockerコンテナをビルド
docker-compose build
# PHPコンテナでLaravelをインストール
docker-compose run --rm php composer create-project laravel/laravel .
```
### 2. Laravel環境設定
`src/.env` ファイルを編集してデータベース設定を変更:
```env
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel_user
DB_PASSWORD=secret
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
```
### 3. コンテナの起動
```bash
docker-compose up -d
```
### 4. Laravel初期設定
```bash
# キャッシュクリア
docker-compose exec php php artisan config:clear
# マイグレーション実行
docker-compose exec php php artisan migrate
```
## アクセスURL
- **アプリケーション**: http://localhost:9700
- **PhpMyAdmin**: http://localhost:9701
- **MailHog Web UI**: http://localhost:9725
## よく使うコマンド
```bash
# コンテナ起動
docker-compose up -d
# コンテナ停止
docker-compose down
# コンテナ再起動
docker-compose restart
# ログ確認
docker-compose logs -f
# PHPコンテナに入る
docker-compose exec php bash
# Artisanコマンド実行
docker-compose exec php php artisan [command]
# Composer実行
docker-compose exec php composer [command]
# npm実行
docker-compose exec php npm [command]
```
## データベース接続情報
- **ホスト**: localhost (外部) / mysql (コンテナ内)
- **ポート**: 9702 (外部) / 3306 (コンテナ内)
- **データベース名**: laravel
- **ユーザー名**: laravel_user
- **パスワード**: secret
- **rootパスワード**: secret
## トラブルシューティング
### パーミッションエラーが出る場合
```bash
# storageとbootstrap/cacheのパーミッション設定
docker-compose exec php chmod -R 775 storage bootstrap/cache
docker-compose exec php chown -R www-data:www-data storage bootstrap/cache
```
### コンテナが起動しない場合
```bash
# コンテナとボリュームを全て削除して再構築
docker-compose down -v
docker-compose build --no-cache
docker-compose up -d
```