質問編集履歴
4
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -75,137 +75,3 @@
|
|
75
75
|
|
76
76
|
|
77
77
|
```
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
--10:25追記---
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
上記事象解決後、下記エラーが出力。
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
Facade\Ignition\Exceptions\ViewException
|
90
|
-
|
91
|
-
Call to undefined function str_limit() (View: C:\xampp\htdocs\laravel\sample\resources\views\posts\index.blade.php)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
```ここに言語を入力
|
98
|
-
|
99
|
-
@extends('layout')
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
@section('content')
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
<div class="container mt-4">
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
@foreach ($posts as $post)
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
<div class="card mb-4">
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<div class="card-header">
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
{{ $post->title }}
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
</div>
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
<div class="card-body">
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
<p class="card-text">
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
{!! nl2br(e(str_limit($post->body, 200))) !!}
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
</p>
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
</div>
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
<div class="card-footer">
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<span class="mr-2">
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
投稿日時 {{ $post->created_at->format('Y.m.d') }}
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
</span>
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
@if ($post->comments->count())
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
<span class="badge badge-primary">
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
コメント {{ $post->comments->count() }}件
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
</span>
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
@endif
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
</div>
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
</div>
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
@endforeach
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
</div>
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
@endsection
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
```
|
210
|
-
|
211
|
-
大変申し訳ございませんが、こちらの対処方法もご教示ください。
|
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -75,3 +75,137 @@
|
|
75
75
|
|
76
76
|
|
77
77
|
```
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
--10:25追記---
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
上記事象解決後、下記エラーが出力。
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
Facade\Ignition\Exceptions\ViewException
|
90
|
+
|
91
|
+
Call to undefined function str_limit() (View: C:\xampp\htdocs\laravel\sample\resources\views\posts\index.blade.php)
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
```ここに言語を入力
|
98
|
+
|
99
|
+
@extends('layout')
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
@section('content')
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<div class="container mt-4">
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
@foreach ($posts as $post)
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<div class="card mb-4">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<div class="card-header">
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
{{ $post->title }}
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
<div class="card-body">
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<p class="card-text">
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
{!! nl2br(e(str_limit($post->body, 200))) !!}
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</p>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
</div>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<div class="card-footer">
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<span class="mr-2">
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
投稿日時 {{ $post->created_at->format('Y.m.d') }}
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
</span>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
@if ($post->comments->count())
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="badge badge-primary">
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
コメント {{ $post->comments->count() }}件
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</span>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
@endif
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
@endforeach
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
@endsection
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
```
|
210
|
+
|
211
|
+
大変申し訳ございませんが、こちらの対処方法もご教示ください。
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -31,3 +31,47 @@
|
|
31
31
|
大変お手数お掛けしますが、エラーの意味と、
|
32
32
|
|
33
33
|
解決方法をご教示ください。
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
エラーが出ているコード
|
40
|
+
|
41
|
+
11行目⇒ $posts = Post::orderBy('created_at', 'desc')->get();
|
42
|
+
|
43
|
+
```ここに言語を入力
|
44
|
+
|
45
|
+
<?php
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
namespace App\Http\Controllers;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
use Illuminate\Http\Request;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
class PostsController extends Controller
|
58
|
+
|
59
|
+
{
|
60
|
+
|
61
|
+
public function index()
|
62
|
+
|
63
|
+
{
|
64
|
+
|
65
|
+
$posts = Post::orderBy('created_at', 'desc')->get();
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
return view('posts.index', ['posts' => $posts]);
|
70
|
+
|
71
|
+
}
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
```
|
1
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,10 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
+
*コードは全部上記サイトからのコピペです。
|
20
|
+
|
21
|
+
|
22
|
+
|
19
23
|
*「http://localhost:8000/」で試しても同事象です。
|
20
24
|
|
21
25
|
|