質問編集履歴

7

テーブル定義追加

2019/08/30 05:32

投稿

KenTse
KenTse

スコア24

test CHANGED
File without changes
test CHANGED
@@ -154,6 +154,8 @@
154
154
 
155
155
  ```
156
156
 
157
+ ![イメージ説明](1c10be7afbf3334c2acb8345b600f9c5.jpeg)
158
+
157
159
  ```Migration
158
160
 
159
161
 

6

発生している問題 修正

2019/08/30 05:32

投稿

KenTse
KenTse

スコア24

test CHANGED
File without changes
test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  formのinputに空に変更で更新する時に、
20
20
 
21
- 何故か現在時刻に自動更新してい
21
+ ** 最大の疑問は下記の"試したこと1"で、nullで設定しているのに、何故かjob_startが現在時刻に更新しています**
22
22
 
23
23
 
24
24
 

5

試したこと修正

2019/08/30 05:24

投稿

KenTse
KenTse

スコア24

test CHANGED
File without changes
test CHANGED
@@ -176,9 +176,9 @@
176
176
 
177
177
  ### 試したこと
178
178
 
179
-
180
-
181
- ```試したこと1
179
+ 試したこと1
180
+
181
+ ```
182
182
 
183
183
  public function edit($id, Request $request){
184
184
 
@@ -192,9 +192,9 @@
192
192
 
193
193
  ```
194
194
 
195
-
196
-
197
- ```試したこと2
195
+ 試したこと2
196
+
197
+ ```
198
198
 
199
199
  public function update($id, Request $request){
200
200
 
@@ -210,4 +210,4 @@
210
210
 
211
211
 
212
212
 
213
- 両方とも何故か現在時刻に更新しています。
213
+ 両方とも何故かjob_startが現在時刻に更新しています。

4

試したこと追加

2019/08/30 02:55

投稿

KenTse
KenTse

スコア24

test CHANGED
File without changes
test CHANGED
@@ -178,22 +178,36 @@
178
178
 
179
179
 
180
180
 
181
- 試しにsetJobStartAttributeの中に
182
-
183
- ```ここに言語を入力
181
+ ```試したと1
182
+
184
-
183
+ public function edit($id, Request $request){
184
+
185
+ $job = Job::findOrFail($id);
186
+
185
- if ( $value === null ){
187
+ $job->job_start = null;
186
-
188
+
187
- value = 'NULL';
189
+ $job->save();
188
190
 
189
191
  }
190
192
 
191
193
  ```
192
194
 
195
+
196
+
197
+ ```試したこと2
198
+
199
+ public function update($id, Request $request){
200
+
201
+ $job = Job::findOrFail($id);
202
+
203
+ $job->fill( $request->input() );
204
+
193
- を設定、でもエラーメッセージ出ました
205
+ $job->save();
206
+
194
-
207
+ }
208
+
195
- ```
209
+ ```
196
-
210
+
211
+
212
+
197
- A four digit year could not be found Data missing
213
+ 両方とも何故か現在時刻に更新しています。
198
-
199
- ```

3

jobs

2019/08/30 02:54

投稿

KenTse
KenTse

スコア24

test CHANGED
File without changes
test CHANGED
@@ -158,7 +158,7 @@
158
158
 
159
159
 
160
160
 
161
- Schema::create('mst_car', function(Blueprint $table)
161
+ Schema::create('jobs', function(Blueprint $table)
162
162
 
163
163
  {
164
164
 

2

Migration

2019/08/30 02:36

投稿

KenTse
KenTse

スコア24

test CHANGED
File without changes
test CHANGED
@@ -154,7 +154,23 @@
154
154
 
155
155
  ```
156
156
 
157
+ ```Migration
157
158
 
159
+
160
+
161
+ Schema::create('mst_car', function(Blueprint $table)
162
+
163
+ {
164
+
165
+ /**省略**/
166
+
167
+ $table->dateTime('job_start')->nullable();
168
+
169
+ $table->dateTime('job_end')->nullable();
170
+
171
+ });
172
+
173
+ ```
158
174
 
159
175
 
160
176
 

1

job_start

2019/08/30 02:35

投稿

KenTse
KenTse

スコア24

test CHANGED
File without changes
test CHANGED
@@ -122,7 +122,7 @@
122
122
 
123
123
  //null ならそのまま?
124
124
 
125
- $this->attributes['kouki_start'] = $value;
125
+ $this->attributes['job_start'] = $value;
126
126
 
127
127
  }
128
128