@famgia/omnify-laravel 0.0.87 → 0.0.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YVVAJA3T.js → chunk-V7LWJ6OM.js} +178 -12
- package/dist/chunk-V7LWJ6OM.js.map +1 -0
- package/dist/index.cjs +180 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +5 -1
- package/dist/plugin.cjs +176 -11
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +5 -5
- package/scripts/postinstall.js +29 -36
- package/stubs/ai-guides/claude-agents/architect.md.stub +150 -0
- package/stubs/ai-guides/claude-agents/developer.md.stub +190 -0
- package/stubs/ai-guides/claude-agents/reviewer.md.stub +134 -0
- package/stubs/ai-guides/claude-agents/tester.md.stub +196 -0
- package/stubs/ai-guides/claude-checklists/backend.md.stub +112 -0
- package/stubs/ai-guides/claude-omnify/antdesign-guide.md.stub +401 -0
- package/stubs/ai-guides/claude-omnify/config-guide.md.stub +253 -0
- package/stubs/ai-guides/claude-omnify/japan-guide.md.stub +186 -0
- package/stubs/ai-guides/claude-omnify/laravel-guide.md.stub +61 -0
- package/stubs/ai-guides/claude-omnify/schema-guide.md.stub +115 -0
- package/stubs/ai-guides/claude-omnify/typescript-guide.md.stub +310 -0
- package/stubs/ai-guides/claude-rules/naming.md.stub +364 -0
- package/stubs/ai-guides/claude-rules/performance.md.stub +251 -0
- package/stubs/ai-guides/claude-rules/security.md.stub +159 -0
- package/stubs/ai-guides/claude-workflows/bug-fix.md.stub +201 -0
- package/stubs/ai-guides/claude-workflows/code-review.md.stub +164 -0
- package/stubs/ai-guides/claude-workflows/new-feature.md.stub +327 -0
- package/stubs/ai-guides/cursor/laravel-controller.mdc.stub +391 -0
- package/stubs/ai-guides/cursor/laravel-request.mdc.stub +112 -0
- package/stubs/ai-guides/cursor/laravel-resource.mdc.stub +73 -0
- package/stubs/ai-guides/cursor/laravel-review.mdc.stub +69 -0
- package/stubs/ai-guides/cursor/laravel-testing.mdc.stub +138 -0
- package/stubs/ai-guides/cursor/laravel.mdc.stub +82 -0
- package/stubs/ai-guides/laravel/README.md.stub +59 -0
- package/stubs/ai-guides/laravel/architecture.md.stub +424 -0
- package/stubs/ai-guides/laravel/controller.md.stub +484 -0
- package/stubs/ai-guides/laravel/datetime.md.stub +334 -0
- package/stubs/ai-guides/laravel/openapi.md.stub +369 -0
- package/stubs/ai-guides/laravel/request.md.stub +450 -0
- package/stubs/ai-guides/laravel/resource.md.stub +516 -0
- package/stubs/ai-guides/laravel/service.md.stub +503 -0
- package/stubs/ai-guides/laravel/testing.md.stub +1504 -0
- package/ai-guides/laravel-guide.md +0 -461
- package/dist/chunk-YVVAJA3T.js.map +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
# Omnify Configuration Guide
|
|
2
|
+
|
|
3
|
+
## Quick Start
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# Create new Laravel project (recommended)
|
|
7
|
+
npx @famgia/omnify create-laravel-project my-app
|
|
8
|
+
cd my-app
|
|
9
|
+
|
|
10
|
+
# Or initialize in existing project
|
|
11
|
+
npx @famgia/omnify init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Configuration File
|
|
15
|
+
|
|
16
|
+
Create `omnify.config.ts` in project root:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { defineConfig } from '@famgia/omnify';
|
|
20
|
+
import laravel from '@famgia/omnify-laravel/plugin';
|
|
21
|
+
import typescript from '@famgia/omnify-typescript/plugin';
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
schemasDir: './schemas',
|
|
25
|
+
lockFilePath: './.omnify.lock',
|
|
26
|
+
|
|
27
|
+
database: {
|
|
28
|
+
driver: 'mysql',
|
|
29
|
+
devUrl: 'mysql://root:password@localhost:3306/dev_db',
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
plugins: [
|
|
33
|
+
laravel({
|
|
34
|
+
migrationsPath: 'database/migrations/omnify',
|
|
35
|
+
modelsPath: 'app/Models',
|
|
36
|
+
baseModelsPath: 'app/Models/OmnifyBase',
|
|
37
|
+
providersPath: 'app/Providers',
|
|
38
|
+
localesPath: 'app/Models/OmnifyBase/Locales',
|
|
39
|
+
}),
|
|
40
|
+
typescript({
|
|
41
|
+
path: './resources/ts/types/models',
|
|
42
|
+
generateRules: true,
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
locale: {
|
|
47
|
+
locales: ['ja', 'en'],
|
|
48
|
+
defaultLocale: 'ja',
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Configuration Options
|
|
54
|
+
|
|
55
|
+
### Root Options
|
|
56
|
+
|
|
57
|
+
| Option | Type | Required | Description |
|
|
58
|
+
|--------|------|----------|-------------|
|
|
59
|
+
| `schemasDir` | `string` | Yes | Directory containing schema files |
|
|
60
|
+
| `lockFilePath` | `string` | Yes | Path to lock file for change tracking |
|
|
61
|
+
| `database` | `object` | Yes | Database configuration |
|
|
62
|
+
| `plugins` | `Plugin[]` | No | Array of generator plugins |
|
|
63
|
+
| `locale` | `object` | No | Multi-language support configuration |
|
|
64
|
+
|
|
65
|
+
### database (required)
|
|
66
|
+
|
|
67
|
+
| Option | Type | Description |
|
|
68
|
+
|--------|------|-------------|
|
|
69
|
+
| `driver` | `string` | Database driver: `mysql`, `pgsql`, `sqlite`, `sqlsrv`, `mariadb` |
|
|
70
|
+
| `devUrl` | `string` | Development database URL for Atlas diff (required for `generate`) |
|
|
71
|
+
| `enableFieldComments` | `boolean` | Enable field comments in migrations (MySQL) |
|
|
72
|
+
|
|
73
|
+
### Database URL Format
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
mysql://user:password@host:port/database
|
|
77
|
+
postgres://user:password@host:port/database
|
|
78
|
+
sqlite://path/to/file.db
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Plugin Configuration
|
|
82
|
+
|
|
83
|
+
### Laravel Plugin
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import laravel from '@famgia/omnify-laravel/plugin';
|
|
87
|
+
|
|
88
|
+
laravel({
|
|
89
|
+
migrationsPath: 'database/migrations/omnify', // Migration files
|
|
90
|
+
modelsPath: 'app/Models', // Model classes
|
|
91
|
+
baseModelsPath: 'app/Models/OmnifyBase', // Base model classes (auto-generated)
|
|
92
|
+
providersPath: 'app/Providers', // Service provider (OmnifyServiceProvider)
|
|
93
|
+
localesPath: 'app/Models/OmnifyBase/Locales', // Locale files
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
| Option | Type | Default | Description |
|
|
98
|
+
|--------|------|---------|-------------|
|
|
99
|
+
| `migrationsPath` | `string` | `database/migrations/omnify` | Laravel migrations output |
|
|
100
|
+
| `modelsPath` | `string` | `app/Models` | Model classes output |
|
|
101
|
+
| `baseModelsPath` | `string` | `app/Models/OmnifyBase` | Base model classes output |
|
|
102
|
+
| `providersPath` | `string` | `app/Providers` | Service provider output |
|
|
103
|
+
| `localesPath` | `string` | `app/Models/OmnifyBase/Locales` | Locale files output |
|
|
104
|
+
|
|
105
|
+
### TypeScript Plugin
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import typescript from '@famgia/omnify-typescript/plugin';
|
|
109
|
+
|
|
110
|
+
typescript({
|
|
111
|
+
path: './resources/ts/types/models', // Output directory
|
|
112
|
+
generateRules: true, // Generate Ant Design validation rules
|
|
113
|
+
})
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Option | Type | Default | Description |
|
|
117
|
+
|--------|------|---------|-------------|
|
|
118
|
+
| `path` | `string` | `./src/types/model` | Output directory for TypeScript types |
|
|
119
|
+
| `generateRules` | `boolean` | `true` | Generate Ant Design validation rules |
|
|
120
|
+
|
|
121
|
+
### Japan Plugin (Optional)
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import japan from '@famgia/omnify-japan/plugin';
|
|
125
|
+
|
|
126
|
+
japan({
|
|
127
|
+
// Japan-specific types: JapaneseName, JapaneseAddress, etc.
|
|
128
|
+
})
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Locale Configuration
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
locale: {
|
|
135
|
+
locales: ['ja', 'en', 'vi'], // Supported locale codes
|
|
136
|
+
defaultLocale: 'ja', // Default locale for simple strings
|
|
137
|
+
fallbackLocale: 'en', // Fallback when requested locale not found
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Commands
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Create new Laravel project
|
|
145
|
+
npx @famgia/omnify create-laravel-project my-app
|
|
146
|
+
|
|
147
|
+
# Initialize in existing project
|
|
148
|
+
npx @famgia/omnify init
|
|
149
|
+
|
|
150
|
+
# Validate all schemas
|
|
151
|
+
npx @famgia/omnify validate
|
|
152
|
+
|
|
153
|
+
# Show pending changes
|
|
154
|
+
npx @famgia/omnify diff
|
|
155
|
+
|
|
156
|
+
# Generate code
|
|
157
|
+
npx @famgia/omnify generate
|
|
158
|
+
|
|
159
|
+
# Generate with options
|
|
160
|
+
npx @famgia/omnify generate --force # Force regenerate
|
|
161
|
+
npx @famgia/omnify generate --migrations-only # Only migrations
|
|
162
|
+
npx @famgia/omnify generate --types-only # Only TypeScript
|
|
163
|
+
|
|
164
|
+
# Reset all generated files
|
|
165
|
+
npx @famgia/omnify reset
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Environment Variables
|
|
169
|
+
|
|
170
|
+
| Variable | Description |
|
|
171
|
+
|----------|-------------|
|
|
172
|
+
| `OMNIFY_DEV_URL` | Override database.devUrl from config |
|
|
173
|
+
| `DEBUG` | Set to `omnify:*` for debug output |
|
|
174
|
+
|
|
175
|
+
## Common Mistakes
|
|
176
|
+
|
|
177
|
+
**Wrong** - `locales` at root level:
|
|
178
|
+
```typescript
|
|
179
|
+
{
|
|
180
|
+
locales: ['en', 'ja'], // ERROR: locales not in OmnifyConfig
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Correct** - `locales` inside `locale` object:
|
|
185
|
+
```typescript
|
|
186
|
+
{
|
|
187
|
+
locale: {
|
|
188
|
+
locales: ['en', 'ja'],
|
|
189
|
+
defaultLocale: 'en',
|
|
190
|
+
},
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Wrong** - Using old `output` format:
|
|
195
|
+
```typescript
|
|
196
|
+
{
|
|
197
|
+
output: {
|
|
198
|
+
laravel: { ... }, // ERROR: Use plugins instead
|
|
199
|
+
typescript: { ... },
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Correct** - Using plugins:
|
|
205
|
+
```typescript
|
|
206
|
+
{
|
|
207
|
+
plugins: [
|
|
208
|
+
laravel({ ... }),
|
|
209
|
+
typescript({ ... }),
|
|
210
|
+
],
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Full Example
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
import { defineConfig } from '@famgia/omnify';
|
|
218
|
+
import laravel from '@famgia/omnify-laravel/plugin';
|
|
219
|
+
import typescript from '@famgia/omnify-typescript/plugin';
|
|
220
|
+
import japan from '@famgia/omnify-japan/plugin';
|
|
221
|
+
|
|
222
|
+
export default defineConfig({
|
|
223
|
+
schemasDir: './schemas',
|
|
224
|
+
lockFilePath: './.omnify.lock',
|
|
225
|
+
|
|
226
|
+
database: {
|
|
227
|
+
driver: 'mysql',
|
|
228
|
+
devUrl: process.env.OMNIFY_DEV_URL || 'mysql://root:password@localhost:3306/dev_db',
|
|
229
|
+
enableFieldComments: true,
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
plugins: [
|
|
233
|
+
laravel({
|
|
234
|
+
migrationsPath: 'database/migrations/omnify',
|
|
235
|
+
modelsPath: 'app/Models',
|
|
236
|
+
baseModelsPath: 'app/Models/OmnifyBase',
|
|
237
|
+
providersPath: 'app/Providers',
|
|
238
|
+
localesPath: 'app/Models/OmnifyBase/Locales',
|
|
239
|
+
}),
|
|
240
|
+
typescript({
|
|
241
|
+
path: './resources/ts/types/models',
|
|
242
|
+
generateRules: true,
|
|
243
|
+
}),
|
|
244
|
+
japan(), // Japan-specific types
|
|
245
|
+
],
|
|
246
|
+
|
|
247
|
+
locale: {
|
|
248
|
+
locales: ['ja', 'en'],
|
|
249
|
+
defaultLocale: 'ja',
|
|
250
|
+
fallbackLocale: 'ja',
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
```
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Japan Plugin Types Guide
|
|
2
|
+
|
|
3
|
+
This project uses `@famgia/omnify-japan` plugin which provides Japan-specific types.
|
|
4
|
+
|
|
5
|
+
## Available Types
|
|
6
|
+
|
|
7
|
+
### Simple Types
|
|
8
|
+
|
|
9
|
+
#### JapanesePhone
|
|
10
|
+
Japanese phone number format (e.g., `090-1234-5678`, `03-1234-5678`)
|
|
11
|
+
- SQL: `VARCHAR(15)`
|
|
12
|
+
- Accepts with or without hyphens
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
phone:
|
|
16
|
+
type: JapanesePhone
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### JapanesePostalCode
|
|
20
|
+
Japanese postal code format (e.g., `123-4567`)
|
|
21
|
+
- SQL: `VARCHAR(8)`
|
|
22
|
+
- Accepts with or without hyphen
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
postal_code:
|
|
26
|
+
type: JapanesePostalCode
|
|
27
|
+
nullable: true
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Compound Types
|
|
31
|
+
|
|
32
|
+
Compound types expand into multiple database columns automatically.
|
|
33
|
+
|
|
34
|
+
#### JapaneseName
|
|
35
|
+
Japanese name with kanji and kana variants.
|
|
36
|
+
|
|
37
|
+
**Expands to 4 columns:**
|
|
38
|
+
- `{property}_lastname` - VARCHAR(50) - Family name (姓)
|
|
39
|
+
- `{property}_firstname` - VARCHAR(50) - Given name (名)
|
|
40
|
+
- `{property}_kana_lastname` - VARCHAR(100) - Family name in katakana
|
|
41
|
+
- `{property}_kana_firstname` - VARCHAR(100) - Given name in katakana
|
|
42
|
+
|
|
43
|
+
**Accessors generated:**
|
|
44
|
+
- `{property}_full_name` - "姓 名" (space-separated)
|
|
45
|
+
- `{property}_full_name_kana` - "セイ メイ" (space-separated)
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
name:
|
|
49
|
+
type: JapaneseName
|
|
50
|
+
displayName:
|
|
51
|
+
ja: 氏名
|
|
52
|
+
en: Full Name
|
|
53
|
+
# Per-field overrides
|
|
54
|
+
fields:
|
|
55
|
+
KanaLastname:
|
|
56
|
+
nullable: true
|
|
57
|
+
hidden: true
|
|
58
|
+
KanaFirstname:
|
|
59
|
+
nullable: true
|
|
60
|
+
hidden: true
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### JapaneseAddress
|
|
64
|
+
Japanese address with postal code and prefecture ID.
|
|
65
|
+
|
|
66
|
+
**Expands to 5 columns:**
|
|
67
|
+
- `{property}_postal_code` - VARCHAR(8) - Postal code (郵便番号)
|
|
68
|
+
- `{property}_prefecture_id` - TINYINT UNSIGNED - Prefecture ID 1-47 (都道府県)
|
|
69
|
+
- `{property}_address1` - VARCHAR(255) - City/Ward (市区町村)
|
|
70
|
+
- `{property}_address2` - VARCHAR(255) - Street address (丁目番地号)
|
|
71
|
+
- `{property}_address3` - VARCHAR(255) NULLABLE - Building name (ビル・マンション名)
|
|
72
|
+
|
|
73
|
+
**Accessors generated:**
|
|
74
|
+
- `{property}_full_address` - Concatenation of address1 + address2 + address3
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
address:
|
|
78
|
+
type: JapaneseAddress
|
|
79
|
+
displayName:
|
|
80
|
+
ja: 住所
|
|
81
|
+
en: Address
|
|
82
|
+
fields:
|
|
83
|
+
Address3:
|
|
84
|
+
nullable: true
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Prefecture IDs (JIS X 0401):**
|
|
88
|
+
| ID | Prefecture | ID | Prefecture | ID | Prefecture |
|
|
89
|
+
|----|-----------|----|-----------|----|-----------|
|
|
90
|
+
| 1 | 北海道 | 17 | 石川県 | 33 | 岡山県 |
|
|
91
|
+
| 2 | 青森県 | 18 | 福井県 | 34 | 広島県 |
|
|
92
|
+
| 3 | 岩手県 | 19 | 山梨県 | 35 | 山口県 |
|
|
93
|
+
| 4 | 宮城県 | 20 | 長野県 | 36 | 徳島県 |
|
|
94
|
+
| 5 | 秋田県 | 21 | 岐阜県 | 37 | 香川県 |
|
|
95
|
+
| 6 | 山形県 | 22 | 静岡県 | 38 | 愛媛県 |
|
|
96
|
+
| 7 | 福島県 | 23 | 愛知県 | 39 | 高知県 |
|
|
97
|
+
| 8 | 茨城県 | 24 | 三重県 | 40 | 福岡県 |
|
|
98
|
+
| 9 | 栃木県 | 25 | 滋賀県 | 41 | 佐賀県 |
|
|
99
|
+
| 10 | 群馬県 | 26 | 京都府 | 42 | 長崎県 |
|
|
100
|
+
| 11 | 埼玉県 | 27 | 大阪府 | 43 | 熊本県 |
|
|
101
|
+
| 12 | 千葉県 | 28 | 兵庫県 | 44 | 大分県 |
|
|
102
|
+
| 13 | 東京都 | 29 | 奈良県 | 45 | 宮崎県 |
|
|
103
|
+
| 14 | 神奈川県 | 30 | 和歌山県 | 46 | 鹿児島県 |
|
|
104
|
+
| 15 | 新潟県 | 31 | 鳥取県 | 47 | 沖縄県 |
|
|
105
|
+
| 16 | 富山県 | 32 | 島根県 | | |
|
|
106
|
+
|
|
107
|
+
#### JapaneseBankAccount
|
|
108
|
+
Japanese bank account information.
|
|
109
|
+
|
|
110
|
+
**Expands to 5 columns:**
|
|
111
|
+
- `{property}_bank_code` - VARCHAR(4) - Bank code (銀行コード)
|
|
112
|
+
- `{property}_branch_code` - VARCHAR(3) - Branch code (支店コード)
|
|
113
|
+
- `{property}_account_type` - ENUM - Account type: 1=普通, 2=当座, 4=貯蓄
|
|
114
|
+
- `{property}_account_number` - VARCHAR(7) - Account number (口座番号)
|
|
115
|
+
- `{property}_account_holder` - VARCHAR(100) - Account holder name (口座名義)
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
bank_account:
|
|
119
|
+
type: JapaneseBankAccount
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Per-field Overrides
|
|
123
|
+
|
|
124
|
+
All compound types support per-field overrides:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
name:
|
|
128
|
+
type: JapaneseName
|
|
129
|
+
fields:
|
|
130
|
+
Lastname:
|
|
131
|
+
length: 100 # Override default VARCHAR length
|
|
132
|
+
Firstname:
|
|
133
|
+
length: 100
|
|
134
|
+
KanaLastname:
|
|
135
|
+
length: 200
|
|
136
|
+
nullable: true
|
|
137
|
+
hidden: true
|
|
138
|
+
KanaFirstname:
|
|
139
|
+
length: 200
|
|
140
|
+
nullable: true
|
|
141
|
+
hidden: true
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Available overrides:**
|
|
145
|
+
- `length` - VARCHAR length (override default)
|
|
146
|
+
- `nullable` - Whether the field can be NULL
|
|
147
|
+
- `hidden` - Exclude from JSON/array output
|
|
148
|
+
- `fillable` - Control mass assignment
|
|
149
|
+
|
|
150
|
+
## Factory Examples
|
|
151
|
+
|
|
152
|
+
```php
|
|
153
|
+
$faker = fake('ja_JP');
|
|
154
|
+
|
|
155
|
+
return [
|
|
156
|
+
// JapaneseName
|
|
157
|
+
'name_lastname' => $faker->lastName(),
|
|
158
|
+
'name_firstname' => $faker->firstName(),
|
|
159
|
+
'name_kana_lastname' => $faker->lastKanaName(),
|
|
160
|
+
'name_kana_firstname' => $faker->firstKanaName(),
|
|
161
|
+
|
|
162
|
+
// JapanesePhone
|
|
163
|
+
'phone' => $faker->phoneNumber(),
|
|
164
|
+
|
|
165
|
+
// JapanesePostalCode
|
|
166
|
+
'postal_code' => $faker->postcode(),
|
|
167
|
+
|
|
168
|
+
// JapaneseAddress
|
|
169
|
+
'address_postal_code' => $faker->postcode(),
|
|
170
|
+
'address_prefecture_id' => $faker->numberBetween(1, 47),
|
|
171
|
+
'address_address1' => $faker->city(),
|
|
172
|
+
'address_address2' => $faker->streetAddress(),
|
|
173
|
+
'address_address3' => $faker->optional(0.5)->secondaryAddress(),
|
|
174
|
+
];
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Model Accessors
|
|
178
|
+
|
|
179
|
+
```php
|
|
180
|
+
// JapaneseName accessors
|
|
181
|
+
$customer->name_full_name; // "田中 太郎"
|
|
182
|
+
$customer->name_full_name_kana; // "タナカ タロウ"
|
|
183
|
+
|
|
184
|
+
// JapaneseAddress accessor
|
|
185
|
+
$customer->address_full_address; // "千代田区丸の内1-1-1ビル5F"
|
|
186
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Laravel Generator Guide
|
|
2
|
+
|
|
3
|
+
## Generated Files
|
|
4
|
+
|
|
5
|
+
### Migrations
|
|
6
|
+
Located in `database/migrations/omnify/`
|
|
7
|
+
- Auto-generated from schema changes
|
|
8
|
+
- Handles column additions, modifications, removals
|
|
9
|
+
- Preserves manual migrations outside omnify folder
|
|
10
|
+
|
|
11
|
+
### Models
|
|
12
|
+
Two-tier model structure:
|
|
13
|
+
- `app/Models/OmnifyBase/*BaseModel.php` - Auto-generated, DO NOT EDIT
|
|
14
|
+
- `app/Models/*.php` - User models, extend base models, safe to customize
|
|
15
|
+
|
|
16
|
+
### Factories
|
|
17
|
+
Located in `database/factories/`
|
|
18
|
+
- Generated once, safe to customize
|
|
19
|
+
- Uses appropriate Faker methods for each type
|
|
20
|
+
|
|
21
|
+
## Model Features
|
|
22
|
+
|
|
23
|
+
### Fillable
|
|
24
|
+
All schema properties are mass-assignable by default.
|
|
25
|
+
Use `fillable: false` to exclude.
|
|
26
|
+
|
|
27
|
+
### Hidden
|
|
28
|
+
Use `hidden: true` to exclude from JSON/array output.
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
password:
|
|
32
|
+
type: Password
|
|
33
|
+
hidden: true
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Casts
|
|
37
|
+
Auto-generated based on property types:
|
|
38
|
+
- `Boolean` → `'boolean'`
|
|
39
|
+
- `Json` → `'array'`
|
|
40
|
+
- `Timestamp` → `'datetime'`
|
|
41
|
+
|
|
42
|
+
### Relationships
|
|
43
|
+
Generated from Association properties:
|
|
44
|
+
- `ManyToOne` → `belongsTo()`
|
|
45
|
+
- `OneToMany` → `hasMany()`
|
|
46
|
+
- `ManyToMany` → `belongsToMany()`
|
|
47
|
+
- `MorphTo` → `morphTo()`
|
|
48
|
+
- `MorphMany` → `morphMany()`
|
|
49
|
+
|
|
50
|
+
## Commands
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Generate migrations and models
|
|
54
|
+
npx omnify generate
|
|
55
|
+
|
|
56
|
+
# Force regeneration
|
|
57
|
+
npx omnify generate --force
|
|
58
|
+
|
|
59
|
+
# Validate schemas
|
|
60
|
+
npx omnify validate
|
|
61
|
+
```
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Omnify Schema Guide
|
|
2
|
+
|
|
3
|
+
## Schema File Format
|
|
4
|
+
|
|
5
|
+
Schemas are YAML files defining data models. Each file represents one entity.
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
name: User
|
|
9
|
+
displayName:
|
|
10
|
+
ja: ユーザー
|
|
11
|
+
en: User
|
|
12
|
+
kind: object
|
|
13
|
+
|
|
14
|
+
properties:
|
|
15
|
+
email:
|
|
16
|
+
type: Email
|
|
17
|
+
unique: true
|
|
18
|
+
name:
|
|
19
|
+
type: String
|
|
20
|
+
bio:
|
|
21
|
+
type: Text
|
|
22
|
+
nullable: true
|
|
23
|
+
|
|
24
|
+
options:
|
|
25
|
+
timestamps: true
|
|
26
|
+
softDelete: true
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Property Types
|
|
30
|
+
|
|
31
|
+
### String Types
|
|
32
|
+
- `String` - VARCHAR(255)
|
|
33
|
+
- `Text` - TEXT
|
|
34
|
+
- `LongText` - LONGTEXT
|
|
35
|
+
- `Email` - VARCHAR(255) for email addresses
|
|
36
|
+
- `Password` - VARCHAR(255), hidden in serialization
|
|
37
|
+
|
|
38
|
+
### Numeric Types
|
|
39
|
+
- `Int` - INTEGER
|
|
40
|
+
- `BigInt` - BIGINT
|
|
41
|
+
- `TinyInt` - TINYINT
|
|
42
|
+
- `Float` - DOUBLE
|
|
43
|
+
- `Decimal` - DECIMAL(precision, scale)
|
|
44
|
+
|
|
45
|
+
### Date/Time Types
|
|
46
|
+
- `Date` - DATE
|
|
47
|
+
- `Time` - TIME
|
|
48
|
+
- `DateTime` - DATETIME
|
|
49
|
+
- `Timestamp` - TIMESTAMP
|
|
50
|
+
|
|
51
|
+
### Other Types
|
|
52
|
+
- `Boolean` - BOOLEAN
|
|
53
|
+
- `Json` - JSON
|
|
54
|
+
- `Enum` - ENUM with values
|
|
55
|
+
- `EnumRef` - Reference to enum schema
|
|
56
|
+
|
|
57
|
+
## Property Options
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
propertyName:
|
|
61
|
+
type: String
|
|
62
|
+
nullable: true # Can be NULL
|
|
63
|
+
unique: true # Unique constraint
|
|
64
|
+
default: "value" # Default value
|
|
65
|
+
length: 100 # VARCHAR length
|
|
66
|
+
hidden: true # Hide from JSON output
|
|
67
|
+
fillable: false # Exclude from mass assignment
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Associations
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
# Many-to-One (belongsTo)
|
|
74
|
+
author:
|
|
75
|
+
type: Association
|
|
76
|
+
relation: ManyToOne
|
|
77
|
+
target: User
|
|
78
|
+
onDelete: CASCADE
|
|
79
|
+
|
|
80
|
+
# One-to-Many (hasMany)
|
|
81
|
+
posts:
|
|
82
|
+
type: Association
|
|
83
|
+
relation: OneToMany
|
|
84
|
+
target: Post
|
|
85
|
+
|
|
86
|
+
# Many-to-Many (belongsToMany)
|
|
87
|
+
tags:
|
|
88
|
+
type: Association
|
|
89
|
+
relation: ManyToMany
|
|
90
|
+
target: Tag
|
|
91
|
+
joinTable: post_tags
|
|
92
|
+
|
|
93
|
+
# Polymorphic
|
|
94
|
+
commentable:
|
|
95
|
+
type: Association
|
|
96
|
+
relation: MorphTo
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Indexes
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
indexes:
|
|
103
|
+
- columns: [status, published_at]
|
|
104
|
+
- columns: [email]
|
|
105
|
+
unique: true
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Schema Options
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
options:
|
|
112
|
+
timestamps: true # Add created_at, updated_at
|
|
113
|
+
softDelete: true # Add deleted_at
|
|
114
|
+
idType: BigInt # Primary key type (Int, BigInt, Uuid)
|
|
115
|
+
```
|