質問編集履歴
1
chats.sendChat.blade.phpを追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -86,6 +86,95 @@
|
|
86
86
|
$table->timestamps();
|
87
87
|
|
88
88
|
```
|
89
|
+
chats.sendChat.blade.php
|
90
|
+
```php
|
91
|
+
@extends('layouts.app')
|
92
|
+
|
93
|
+
@section('content')
|
94
|
+
<div class="mt-4">
|
95
|
+
<div class="m-auto px-4 py-5 mt-2 max-w-xl bg-white rounded-lg " >
|
96
|
+
<div class="row">
|
97
|
+
<div class="col-start-2 col-span-4 ">
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
{{-- チャットルーム --}}
|
104
|
+
<div id="room" class="justify-items-stretch">
|
105
|
+
|
106
|
+
<h1 class="text-lg mb-2">
|
107
|
+
<a class="no-underline hover:underline text-black" href="{{ route('users.items',[$user[0]->id]) }}">
|
108
|
+
{{ $user[0]->name }}</a> さんへ
|
109
|
+
{{ $item->title }} について
|
110
|
+
|
111
|
+
</h1>
|
112
|
+
<hr>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
@foreach($messages as $message)
|
117
|
+
|
118
|
+
{{-- 送信したメッセージ --}}
|
119
|
+
@if($message->send == \Illuminate\Support\Facades\Auth::id())
|
120
|
+
<div class="flex items-end justify-end">
|
121
|
+
<div class="send mr-2 bg-green-300 mx-1 my-1 px-1 rounded-lg" style="text-align: right">
|
122
|
+
<p>{{$message->message}}</p>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</div>
|
126
|
+
<p class="text-xs " style="text-align: right">{{ $message->user->name }}</p>
|
127
|
+
@endif
|
128
|
+
|
129
|
+
{{-- 受信したメッセージ --}}
|
130
|
+
@if($message->receive == \Illuminate\Support\Facades\Auth::id())
|
131
|
+
<div class="flex items-start justify-start">
|
132
|
+
<div class="receive mr-2 bg-gray-300 mx-1 my-1 px-1 rounded-lg" style="text-align: left">
|
133
|
+
<p >{{$message->message}}</p>
|
134
|
+
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
<p class="text-xs ">{{ $message->user->name }}</p>
|
138
|
+
@endif
|
139
|
+
|
140
|
+
|
141
|
+
@endforeach
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
<form >
|
146
|
+
@csrf
|
147
|
+
|
148
|
+
<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>
|
149
|
+
|
150
|
+
<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" >
|
151
|
+
<svg
|
152
|
+
class="w-4 h-4 transform rotate-45 -mt-px"
|
153
|
+
fill="none"
|
154
|
+
stroke="currentColor"
|
155
|
+
viewBox="0 0 24 24"
|
156
|
+
xmlns="http://www.w3.org/2000/svg"
|
157
|
+
>
|
158
|
+
<path
|
159
|
+
stroke-linecap="round"
|
160
|
+
stroke-linejoin="round"
|
161
|
+
stroke-width="2"
|
162
|
+
d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
|
163
|
+
></path>
|
164
|
+
</svg></button>
|
165
|
+
|
166
|
+
|
167
|
+
</form>
|
168
|
+
<input type="hidden" name="send" value="{{$param['send']}}">
|
169
|
+
<input type="hidden" name="receive" value="{{$param['receive']}}">
|
170
|
+
<input type="hidden" name="login" value="{{\Illuminate\Support\Facades\Auth::id()}}">
|
171
|
+
<input type="hidden" name="item_id" value="{{$item->id}}">
|
172
|
+
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
@endsection
|
176
|
+
|
177
|
+
```
|
89
178
|
javascript
|
90
179
|
```ここに言語を入力
|
91
180
|
<script type="text/javascript">
|