質問編集履歴

4

fad

2017/05/05 11:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -42,9 +42,9 @@
42
42
 
43
43
 
44
44
 
45
-
46
-
47
- ```CreateOrdersTable
45
+ # CreateOrdersTable
46
+
47
+ ```
48
48
 
49
49
  <?php
50
50
 
@@ -132,9 +132,9 @@
132
132
 
133
133
 
134
134
 
135
-
136
-
137
- ```CreateProductsTable
135
+ #CreateProductsTable
136
+
137
+ ```
138
138
 
139
139
  <?php
140
140
 
@@ -216,9 +216,9 @@
216
216
 
217
217
 
218
218
 
219
-
220
-
221
- ```CreateCustomersTable
219
+ #CreateCustomersTable
220
+
221
+ ```
222
222
 
223
223
  <?php
224
224
 

3

fad

2017/05/05 11:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
 
46
46
 
47
- ```
47
+ ```CreateOrdersTable
48
48
 
49
49
  <?php
50
50
 
@@ -134,7 +134,7 @@
134
134
 
135
135
 
136
136
 
137
- ```
137
+ ```CreateProductsTable
138
138
 
139
139
  <?php
140
140
 
@@ -218,7 +218,7 @@
218
218
 
219
219
 
220
220
 
221
- ```
221
+ ```CreateCustomersTable
222
222
 
223
223
  <?php
224
224
 

2

fa

2017/05/05 11:54

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -129,3 +129,195 @@
129
129
  }
130
130
 
131
131
  ```
132
+
133
+
134
+
135
+
136
+
137
+ ```
138
+
139
+ <?php
140
+
141
+
142
+
143
+ use Illuminate\Support\Facades\Schema;
144
+
145
+ use Illuminate\Database\Schema\Blueprint;
146
+
147
+ use Illuminate\Database\Migrations\Migration;
148
+
149
+
150
+
151
+ class CreateProductsTable extends Migration
152
+
153
+ {
154
+
155
+ /**
156
+
157
+ * Run the migrations.
158
+
159
+ *
160
+
161
+ * @return void
162
+
163
+ */
164
+
165
+ public function up()
166
+
167
+ {
168
+
169
+ Schema::create('products', function (Blueprint $table) {
170
+
171
+ $table->increments('product_id');
172
+
173
+ $table->string('product_name')->unique("product_name");
174
+
175
+ $table->timestamps();
176
+
177
+ $table->softDeletes();
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ });
190
+
191
+ }
192
+
193
+
194
+
195
+ /**
196
+
197
+ * Reverse the migrations.
198
+
199
+ *
200
+
201
+ * @return void
202
+
203
+ */
204
+
205
+ public function down()
206
+
207
+ {
208
+
209
+ Schema::dropIfExists('products');
210
+
211
+ }
212
+
213
+ }
214
+
215
+ ```
216
+
217
+
218
+
219
+
220
+
221
+ ```
222
+
223
+ <?php
224
+
225
+
226
+
227
+ use Illuminate\Support\Facades\Schema;
228
+
229
+ use Illuminate\Database\Schema\Blueprint;
230
+
231
+ use Illuminate\Database\Migrations\Migration;
232
+
233
+
234
+
235
+ class CreateCustomersTable extends Migration
236
+
237
+ {
238
+
239
+ /**
240
+
241
+ * Run the migrations.
242
+
243
+ *
244
+
245
+ * @return void
246
+
247
+ */
248
+
249
+ public function up()
250
+
251
+ {
252
+
253
+ Schema::create('customers', function (Blueprint $table) {
254
+
255
+ $table->increments('customer_id');
256
+
257
+
258
+
259
+ $table->integer("building_id")->unsigned();
260
+
261
+ $table->foreign('building_id')->references('building_id')->on('buildings');
262
+
263
+
264
+
265
+ $table->integer("room_id")->unsigned();
266
+
267
+ $table->foreign('room_id')->references('room_id')->on('rooms');
268
+
269
+
270
+
271
+ $table->string("last_name")->nullable();
272
+
273
+ $table->string("first_name")->nullable();
274
+
275
+
276
+
277
+ $table->string("phone_number")->nullable();
278
+
279
+ $table->enum("choices", ["male, female"]);
280
+
281
+ $table->text('memo')->nullable();
282
+
283
+
284
+
285
+ $table->timestamps();
286
+
287
+ $table->softDeletes();
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+ });
296
+
297
+ }
298
+
299
+
300
+
301
+ /**
302
+
303
+ * Reverse the migrations.
304
+
305
+ *
306
+
307
+ * @return void
308
+
309
+ */
310
+
311
+ public function down()
312
+
313
+ {
314
+
315
+ Schema::dropIfExists('customers');
316
+
317
+ }
318
+
319
+ }
320
+
321
+
322
+
323
+ ```

1

r

2017/05/05 11:53

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
File without changes