0
페이지에 채용 정보 목록이 있습니다. 각 게시마다 '친구에게 보내기'버튼이 있습니다. 버튼을 클릭하면 친구의 이메일을 입력하고 양식을 제출할 수있는 양식이있는 모달이 표시됩니다.Laravel and Modals : 고유 한 @foreach 값을 모달 형식으로 전달 하시겠습니까?
관련 작업 게시 이름을 양식으로 가져 오려면 어떻게해야합니까? {{$ posting-> 이름}}
작업 게시물 페이지 :
@foreach ($postings as $posting)
<a href="postings/{{ $posting->id }}"> <p> {{ $posting-> short_desc }} </p> </a>
<p> {{ $posting->location }} | {{ $posting->duration }} </p>
<button type="button" class="btn btn-outline" data-toggle="modal" href="postings/sendfriend" value="{{ $posting->short_desc }}" data-target="#sendfriend" style="background-color: #004AAE; color: #FFF; font-family: Lato; border-radius: 10px;">Send to a friend</button>
@endforeach
@include('postings.sendfriend')
모달 :
<div id="sendfriend" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Invite a friend to apply for this rotation</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" method="post" action="{{ action('[email protected]') }}">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Enter friend's email">
</div>
</div>
<button type="submit" class="btn btn-outline"> Share the love </button>
</div></div>
</form></div></div>
친구 컨트롤러 :
public function store() {
$friend = new Friend;
$friend->email = request('email');
$friend->company = $posting->name; //Something like this
}