我正在尝试在页面中放置新的消息模式,但是,如果我有很多联系人,即使我还有其他用户,我也总是具有相同的用户名/ ID ...上面,在网络部分,我有我的联系人,我使用的是@foreach($user->contact as $contact)
,并且可以正确更改我的联系人姓名。当我尝试将此@foreach
放在本节中时,我在模式标题中使用了所有4个名称,例如{ {1}}等。如何添加它以正确显示我的模态?
我的观点
Send message to user1 , Send message to user2, Send message to user3
我的模态
<li class="send-contact-message" data-user-id="{{ $contact->id }}">
<a href="javascript:void(0)" data-toggle="modal" data-target="#exampleModal2"><i class="fa fa-paper-plane"></i>Message</a>
</li>
Foreach代码
<!-- Modal2 -->
<div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="mt-5">Send message to {{ $contact->username }}</h4>
</div>
<div class="modal-body">
{!! Form::open(['class' => 'sky-form sky-changes-3','url' => 'message-send','id' => 'sky-form3']) !!}
<input type="hidden" name="contact_user_id" value="{{ $contact->id }}">
<input type="hidden" name="url" >
<fieldset>
<section>
<label class="label">Subject</label>
<label class="input">
<i class="icon-append fa fa-tag"></i>
<input type="text" name="subject" id="subject">
</label>
</section>
<section>
<label class="label">Message</label>
<label class="textarea">
<i class="icon-append fa fa-comment"></i>
<textarea rows="4" name="message" id="message"></textarea>
</label>
</section>
</fieldset>
<div class="message">
<i class="rounded-x fa fa-check"></i>
<p>Your message was successfully sent!</p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
@if(Sentinel::check())
@if(Sentinel::check()->premium == 0)
@if(Sentinel::check()->email_count < 25)
<button type="submit" class="btn-u">Send message</button>
@else
<button type="submit" class="btn-u" disabled>Send message</button>
@endif
@endif
@endif
@if(!Sentinel::check())
<button type="submit" class="btn-u" disabled>Send message</button>
@endif
</div>
</div>
</div>
</div>
</form>