質問編集履歴
1
app.js、適応させたいファイルの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,18 +46,12 @@
|
|
46
46
|
|
47
47
|
<link href="{{ secure_asset('css/custom.css') }}" rel="stylesheet">
|
48
48
|
|
49
|
+
|
50
|
+
|
51
|
+
<title>@yield('title')</title>
|
52
|
+
|
49
53
|
|
50
54
|
|
51
|
-
<!-- Scripts -->
|
52
|
-
|
53
|
-
<!--<script src="{{ asset('js/app.js') }}" defer></script>-->
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
<title>@yield('title')</title>
|
58
|
-
|
59
|
-
|
60
|
-
|
61
55
|
</head>
|
62
56
|
|
63
57
|
<body>
|
@@ -188,12 +182,214 @@
|
|
188
182
|
|
189
183
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
|
190
184
|
|
185
|
+
<script src="{{ asset('js/app.js') }}"></script>
|
186
|
+
|
191
187
|
</body>
|
192
188
|
|
193
189
|
</html>
|
194
190
|
|
195
191
|
```
|
196
192
|
|
193
|
+
適用させたいファイル
|
194
|
+
|
195
|
+
```
|
196
|
+
|
197
|
+
@extends('layouts.admin')
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
@section('title', '掲示板')
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
@section('content')
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<div class="container" id="app">
|
210
|
+
|
211
|
+
<div class="row justify-content-center">
|
212
|
+
|
213
|
+
<div class="col-md-12">
|
214
|
+
|
215
|
+
<div class="row">
|
216
|
+
|
217
|
+
<h5 class="mt-2 ml-2">投稿一覧</h5>
|
218
|
+
|
219
|
+
<a href="{{ action('PostController@create') }}" class="btn btn-primary ml-auto mr-2">新規投稿</a>
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
<div class="row mt-3">
|
226
|
+
|
227
|
+
<div class="col-md-5">
|
228
|
+
|
229
|
+
<form action="{{ route('posts.index') }}" method="get">
|
230
|
+
|
231
|
+
<div class="form-group row align-items-right">
|
232
|
+
|
233
|
+
<div class="col-auto">
|
234
|
+
|
235
|
+
<input type="text" class="form-control" name="user_name" value="{{ $user_name }}" placeholder="ユーザー名">
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="col-auto">
|
240
|
+
|
241
|
+
@csrf
|
242
|
+
|
243
|
+
<input type="submit" class="btn btn-primary" value="検索">
|
244
|
+
|
245
|
+
</div>
|
246
|
+
|
247
|
+
</div>
|
248
|
+
|
249
|
+
</form>
|
250
|
+
|
251
|
+
</div>
|
252
|
+
|
253
|
+
</div>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
@foreach ($posts as $post)
|
258
|
+
|
259
|
+
<a href="{{ route('posts.show', $post->id) }}">
|
260
|
+
|
261
|
+
<div class="card mt-4">
|
262
|
+
|
263
|
+
<div class="card-header">
|
264
|
+
|
265
|
+
<p class="card-title my-0">{{ $post->title }}</p>
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
<div class="card-body">
|
272
|
+
|
273
|
+
<p class="card-text">{{ $post->body }}</p>
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
</a>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<div class="card-footer py-1">
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
<div class="btn-toolbar float-left">
|
286
|
+
|
287
|
+
<div class="btn-group mr-2">
|
288
|
+
|
289
|
+
<like-component
|
290
|
+
|
291
|
+
:post="{{ json_encode($post) }}"
|
292
|
+
|
293
|
+
></like-component></like-component>
|
294
|
+
|
295
|
+
</div>
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
<p class="my-auto text-muted text-right">投稿者:{{ $post->user->name }} 投稿日時:{{ $post->created_at }}</p>
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
@endforeach
|
308
|
+
|
309
|
+
</div>
|
310
|
+
|
311
|
+
</div>
|
312
|
+
|
313
|
+
</div>
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
@endsection
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
```
|
322
|
+
|
323
|
+
app.js
|
324
|
+
|
325
|
+
```
|
326
|
+
|
327
|
+
/**
|
328
|
+
|
329
|
+
* First we will load all of this project's JavaScript dependencies which
|
330
|
+
|
331
|
+
* includes Vue and other libraries. It is a great starting point when
|
332
|
+
|
333
|
+
* building robust, powerful web applications using Vue and Laravel.
|
334
|
+
|
335
|
+
*/
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
require('./bootstrap');
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
window.Vue = require('vue');
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
/**
|
348
|
+
|
349
|
+
* The following block of code may be used to automatically register your
|
350
|
+
|
351
|
+
* Vue components. It will recursively scan this directory for the Vue
|
352
|
+
|
353
|
+
* components and automatically register them with their "basename".
|
354
|
+
|
355
|
+
*
|
356
|
+
|
357
|
+
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
|
358
|
+
|
359
|
+
*/
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
// const files = require.context('./', true, /.vue$/i)
|
364
|
+
|
365
|
+
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
Vue.component('like-component', require('./components/LikeComponent.vue').default);
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
/**
|
374
|
+
|
375
|
+
* Next, we will create a fresh Vue application instance and attach it to
|
376
|
+
|
377
|
+
* the page. Then, you may begin adding components to this application
|
378
|
+
|
379
|
+
* or customize the JavaScript scaffolding to fit your unique needs.
|
380
|
+
|
381
|
+
*/
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
const app = new Vue({
|
386
|
+
|
387
|
+
el: '#app',
|
388
|
+
|
389
|
+
});
|
390
|
+
|
391
|
+
```
|
392
|
+
|
197
393
|
エラーに対して自分がやっていたこと
|
198
394
|
|
199
395
|
- head内にある<script src="{{ asset('js/app.js') }}" defer></script>を消すとドロップダウンメニューは動きました。
|