質問編集履歴
1
Home.vueとapi.phpを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -68,6 +68,140 @@
|
|
68
68
|
|
69
69
|
```
|
70
70
|
|
71
|
+
Home.vue
|
72
|
+
|
73
|
+
```ここに言語を入力
|
74
|
+
|
75
|
+
<template>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div class="container is-fullhd">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</main>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<div class="container">
|
88
|
+
|
89
|
+
<div class="notification">
|
90
|
+
|
91
|
+
<div class="columns">
|
92
|
+
|
93
|
+
<div class="column">
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<br/>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<div>
|
102
|
+
|
103
|
+
<form>
|
104
|
+
|
105
|
+
<button @click.stop.prevent="goQuiz()" class="button is-info is-centered">クイズ</button>
|
106
|
+
|
107
|
+
</form>
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<section class="home__notice">
|
116
|
+
|
117
|
+
<h2 class="title is-4">
|
118
|
+
|
119
|
+
お知らせ
|
120
|
+
|
121
|
+
</h2>
|
122
|
+
|
123
|
+
<dl v-for="(info, index) in information" :key="index">
|
124
|
+
|
125
|
+
<dt>{{info.created_at}}</dt>
|
126
|
+
|
127
|
+
<dd>{{info.information}}</dd>
|
128
|
+
|
129
|
+
</dl>
|
130
|
+
|
131
|
+
</section>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
</div>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
</main>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
</template>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<script>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
export default {
|
160
|
+
|
161
|
+
data() {
|
162
|
+
|
163
|
+
return {
|
164
|
+
|
165
|
+
information: [],
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
};
|
170
|
+
|
171
|
+
},
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
mounted() {
|
176
|
+
|
177
|
+
this.$http.get("/api/information").then(response => {
|
178
|
+
|
179
|
+
this.information = response.data;
|
180
|
+
|
181
|
+
});
|
182
|
+
|
183
|
+
},
|
184
|
+
|
185
|
+
methods: {
|
186
|
+
|
187
|
+
goQuiz() {
|
188
|
+
|
189
|
+
this.$router.push("/quiz");
|
190
|
+
|
191
|
+
},
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
},
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
};
|
200
|
+
|
201
|
+
</script>
|
202
|
+
|
203
|
+
```
|
204
|
+
|
71
205
|
|
72
206
|
|
73
207
|
LoginController.php(api_tokenをセッションに保存する処理)
|
@@ -187,3 +321,23 @@
|
|
187
321
|
}
|
188
322
|
|
189
323
|
```
|
324
|
+
|
325
|
+
Seederで作成したinformationやquizのデータが表示されていないのでルーティングがおかしいのではと思いましたがわかりませんでした。
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
api.php
|
330
|
+
|
331
|
+
```ここに言語を入力
|
332
|
+
|
333
|
+
Route::group(['middleware' => ['api']], function () {
|
334
|
+
|
335
|
+
Route::get('information', 'Api\InformationController@index');
|
336
|
+
|
337
|
+
Route::get('quiz', 'Api\QuizController@show');
|
338
|
+
|
339
|
+
Route::get('ranking', 'Api\RankingController@index');
|
340
|
+
|
341
|
+
});
|
342
|
+
|
343
|
+
```
|