質問編集履歴

1

chats.sendChat.blade.phpを追加しました

2021/01/17 07:19

投稿

kk0055
kk0055

スコア5

test CHANGED
File without changes
test CHANGED
@@ -174,6 +174,184 @@
174
174
 
175
175
  ```
176
176
 
177
+ chats.sendChat.blade.php
178
+
179
+ ```php
180
+
181
+ @extends('layouts.app')
182
+
183
+
184
+
185
+ @section('content')
186
+
187
+ <div class="mt-4">
188
+
189
+ <div class="m-auto px-4 py-5 mt-2 max-w-xl bg-white rounded-lg " >
190
+
191
+ <div class="row">
192
+
193
+ <div class="col-start-2 col-span-4 ">
194
+
195
+
196
+
197
+
198
+
199
+ </div>
200
+
201
+ </div>
202
+
203
+
204
+
205
+ {{-- チャットルーム --}}
206
+
207
+ <div id="room" class="justify-items-stretch">
208
+
209
+
210
+
211
+ <h1 class="text-lg mb-2">
212
+
213
+ <a class="no-underline hover:underline text-black" href="{{ route('users.items',[$user[0]->id]) }}">
214
+
215
+ {{ $user[0]->name }}</a> さんへ
216
+
217
+ {{ $item->title }} について
218
+
219
+
220
+
221
+ </h1>
222
+
223
+ <hr>
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+ @foreach($messages as $message)
232
+
233
+
234
+
235
+ {{-- 送信したメッセージ --}}
236
+
237
+ @if($message->send == \Illuminate\Support\Facades\Auth::id())
238
+
239
+ <div class="flex items-end justify-end">
240
+
241
+ <div class="send mr-2 bg-green-300 mx-1 my-1 px-1 rounded-lg" style="text-align: right">
242
+
243
+ <p>{{$message->message}}</p>
244
+
245
+ </div>
246
+
247
+
248
+
249
+ </div>
250
+
251
+ <p class="text-xs " style="text-align: right">{{ $message->user->name }}</p>
252
+
253
+ @endif
254
+
255
+
256
+
257
+ {{-- 受信したメッセージ --}}
258
+
259
+ @if($message->receive == \Illuminate\Support\Facades\Auth::id())
260
+
261
+ <div class="flex items-start justify-start">
262
+
263
+ <div class="receive mr-2 bg-gray-300 mx-1 my-1 px-1 rounded-lg" style="text-align: left">
264
+
265
+ <p >{{$message->message}}</p>
266
+
267
+
268
+
269
+ </div>
270
+
271
+ </div>
272
+
273
+ <p class="text-xs ">{{ $message->user->name }}</p>
274
+
275
+ @endif
276
+
277
+
278
+
279
+
280
+
281
+ @endforeach
282
+
283
+
284
+
285
+ </div>
286
+
287
+
288
+
289
+ <form >
290
+
291
+ @csrf
292
+
293
+
294
+
295
+ <textarea name="message" style="width:100%" class="mt-1 p-1 focus:outline-none focus:ring focus:border-blue-300 block w-full shadow-sm sm:text-sm border border-indigo-600 rounded-xl"></textarea>
296
+
297
+
298
+
299
+ <button type="button" id="btn_send" class="inline-flex justify-center py-2 px-8 mt-1 border border-transparent shadow-sm text-sm font-medium rounded-xl text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 " style="float: right" >
300
+
301
+ <svg
302
+
303
+ class="w-4 h-4 transform rotate-45 -mt-px"
304
+
305
+ fill="none"
306
+
307
+ stroke="currentColor"
308
+
309
+ viewBox="0 0 24 24"
310
+
311
+ xmlns="http://www.w3.org/2000/svg"
312
+
313
+ >
314
+
315
+ <path
316
+
317
+ stroke-linecap="round"
318
+
319
+ stroke-linejoin="round"
320
+
321
+ stroke-width="2"
322
+
323
+ d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
324
+
325
+ ></path>
326
+
327
+ </svg></button>
328
+
329
+
330
+
331
+
332
+
333
+ </form>
334
+
335
+ <input type="hidden" name="send" value="{{$param['send']}}">
336
+
337
+ <input type="hidden" name="receive" value="{{$param['receive']}}">
338
+
339
+ <input type="hidden" name="login" value="{{\Illuminate\Support\Facades\Auth::id()}}">
340
+
341
+ <input type="hidden" name="item_id" value="{{$item->id}}">
342
+
343
+
344
+
345
+ </div>
346
+
347
+ </div>
348
+
349
+ @endsection
350
+
351
+
352
+
353
+ ```
354
+
177
355
  javascript
178
356
 
179
357
  ```ここに言語を入力