質問編集履歴

5

修正内容

2017/10/16 09:49

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -37,149 +37,3 @@
37
37
  exit;
38
38
 
39
39
  ```
40
-
41
-
42
-
43
- 全データです
44
-
45
- ```
46
-
47
- class TestApiController extends Controller
48
-
49
- {
50
-
51
-
52
-
53
- public $successStatus = 200;
54
-
55
-
56
-
57
- public function index()
58
-
59
-
60
-
61
- {
62
-
63
-
64
-
65
- $authentication_key = 'nhhsq847283dsd';
66
-
67
-
68
-
69
- if($authentication_key === true){
70
-
71
- return response()->json(['success' => $success], $this->successStatus, Test_info::all());
72
-
73
- }else{
74
-
75
-
76
-
77
- // パラメータがない場合はこの処理に来るので401
78
-
79
- return Response::json(['message' => '401 Unauthorized'],401);
80
-
81
-
82
-
83
- }
84
-
85
-
86
-
87
-
88
-
89
- }
90
-
91
-
92
-
93
- public function store(Request $request)
94
-
95
- {
96
-
97
-
98
-
99
- $json = json_decode($request->all()['data'], true);
100
-
101
- //dd($json['job']['user_id']);
102
-
103
- //exit;
104
-
105
-
106
-
107
- try {
108
-
109
- $jobs = DB::table('users')->where('user_id', $json['basic_info']['user_id'])->first();
110
-
111
- //取得したデータを違うテーブルに保存
112
-
113
- DB::table('profile')->insert([
114
-
115
- 'id'=>$json['basic_info']['user_id'],//これはAPIでこないので、すでにあるUserテーブル情報で保存。
116
-
117
-
118
-
119
- 'gender'=>$json['profile']['sex'],
120
-
121
- 'birth_on'=>$json['profile']['birth_day'],
122
-
123
-
124
-
125
- ]);
126
-
127
-
128
-
129
- //取得したデータを違うテーブルに保存
130
-
131
- DB::table('offers')->insert([
132
-
133
- 'site_name'=>$json['apply']['site_name'],
134
-
135
- 'url'=>$json['apply']['url'],
136
-
137
-
138
-
139
- ]);
140
-
141
- }
142
-
143
- catch(\Exception $ex){
144
-
145
- //dd($ex);
146
-
147
- return Response::json(['message' => '500 Unauthorized'],500);
148
-
149
- exit;
150
-
151
- }
152
-
153
-
154
-
155
- return $response;
156
-
157
-
158
-
159
- }
160
-
161
- ```
162
-
163
-
164
-
165
- 送ってくるJsonデータ:
166
-
167
-
168
-
169
- ```
170
-
171
- {"auth_key":"xfe45sg345gszdf3","basic":{"user_id":8,"name":"h","email":"example@example.com",},
172
-
173
- "profile":{"profile_image":"uploads/profile_image/1/profile.png","birth_day":"1989-01-01",
174
-
175
- "sex":1,"other":{"other_1":null,"other_2":"xxx",},
176
-
177
- "experience_industries":["IT","メーカー"],"overseas_experiences":[{"location":"xxx","staying":"czxc"}],
178
-
179
- },
180
-
181
-
182
-
183
- "apply":{"xxx_id":"1111","url":"/test_1111",}}
184
-
185
- ```

4

修正

2017/10/16 09:49

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -130,9 +130,9 @@
130
130
 
131
131
  DB::table('offers')->insert([
132
132
 
133
- 'job_id'=>$json['apply']['site_name'],
133
+ 'site_name'=>$json['apply']['site_name'],
134
134
 
135
- 'job_id'=>$json['apply']['url'],
135
+ 'url'=>$json['apply']['url'],
136
136
 
137
137
 
138
138
 

3

修正

2017/10/16 04:46

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -159,3 +159,27 @@
159
159
  }
160
160
 
161
161
  ```
162
+
163
+
164
+
165
+ 送ってくるJsonデータ:
166
+
167
+
168
+
169
+ ```
170
+
171
+ {"auth_key":"xfe45sg345gszdf3","basic":{"user_id":8,"name":"h","email":"example@example.com",},
172
+
173
+ "profile":{"profile_image":"uploads/profile_image/1/profile.png","birth_day":"1989-01-01",
174
+
175
+ "sex":1,"other":{"other_1":null,"other_2":"xxx",},
176
+
177
+ "experience_industries":["IT","メーカー"],"overseas_experiences":[{"location":"xxx","staying":"czxc"}],
178
+
179
+ },
180
+
181
+
182
+
183
+ "apply":{"xxx_id":"1111","url":"/test_1111",}}
184
+
185
+ ```

2

編集

2017/10/16 04:45

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -37,3 +37,125 @@
37
37
  exit;
38
38
 
39
39
  ```
40
+
41
+
42
+
43
+ 全データです
44
+
45
+ ```
46
+
47
+ class TestApiController extends Controller
48
+
49
+ {
50
+
51
+
52
+
53
+ public $successStatus = 200;
54
+
55
+
56
+
57
+ public function index()
58
+
59
+
60
+
61
+ {
62
+
63
+
64
+
65
+ $authentication_key = 'nhhsq847283dsd';
66
+
67
+
68
+
69
+ if($authentication_key === true){
70
+
71
+ return response()->json(['success' => $success], $this->successStatus, Test_info::all());
72
+
73
+ }else{
74
+
75
+
76
+
77
+ // パラメータがない場合はこの処理に来るので401
78
+
79
+ return Response::json(['message' => '401 Unauthorized'],401);
80
+
81
+
82
+
83
+ }
84
+
85
+
86
+
87
+
88
+
89
+ }
90
+
91
+
92
+
93
+ public function store(Request $request)
94
+
95
+ {
96
+
97
+
98
+
99
+ $json = json_decode($request->all()['data'], true);
100
+
101
+ //dd($json['job']['user_id']);
102
+
103
+ //exit;
104
+
105
+
106
+
107
+ try {
108
+
109
+ $jobs = DB::table('users')->where('user_id', $json['basic_info']['user_id'])->first();
110
+
111
+ //取得したデータを違うテーブルに保存
112
+
113
+ DB::table('profile')->insert([
114
+
115
+ 'id'=>$json['basic_info']['user_id'],//これはAPIでこないので、すでにあるUserテーブル情報で保存。
116
+
117
+
118
+
119
+ 'gender'=>$json['profile']['sex'],
120
+
121
+ 'birth_on'=>$json['profile']['birth_day'],
122
+
123
+
124
+
125
+ ]);
126
+
127
+
128
+
129
+ //取得したデータを違うテーブルに保存
130
+
131
+ DB::table('offers')->insert([
132
+
133
+ 'job_id'=>$json['apply']['site_name'],
134
+
135
+ 'job_id'=>$json['apply']['url'],
136
+
137
+
138
+
139
+ ]);
140
+
141
+ }
142
+
143
+ catch(\Exception $ex){
144
+
145
+ //dd($ex);
146
+
147
+ return Response::json(['message' => '500 Unauthorized'],500);
148
+
149
+ exit;
150
+
151
+ }
152
+
153
+
154
+
155
+ return $response;
156
+
157
+
158
+
159
+ }
160
+
161
+ ```

1

修正

2017/10/16 04:44

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  $user = DB::table('users')->where('user_id',$json['basic_info']['user_id'])->first();
14
14
 
15
- dd($jobs->user_id);
15
+ dd($user->user_id);
16
16
 
17
17
  exit;
18
18
 
@@ -32,7 +32,7 @@
32
32
 
33
33
  $users = DB::table('users')->where('user_id', 25)->first();
34
34
 
35
- dd($jobs->user_id);
35
+ dd($users->user_id);
36
36
 
37
37
  exit;
38
38