Php 将数据从laravel控制器传递到Modal
我想在Modal中进行编辑,但数据没有传递到包含Modal:-(以下是我的代码: 谁能帮我看看我做错了什么 //route.phpPhp 将数据从laravel控制器传递到Modal,php,laravel-5,bootstrap-modal,laravel-blade,Php,Laravel 5,Bootstrap Modal,Laravel Blade,我想在Modal中进行编辑,但数据没有传递到包含Modal:-(以下是我的代码: 谁能帮我看看我做错了什么 //route.php Route::resource('/admin/opgave', 'Admin\OpgaveController'); //OpgaveController.php public function edit($id) { $tasks = Tasks::findOrFail($id); return view('admin.op
Route::resource('/admin/opgave', 'Admin\OpgaveController');
//OpgaveController.php
public function edit($id)
{
$tasks = Tasks::findOrFail($id);
return view('admin.opgaver.opgaveRet', ['tasks' => $tasks ]);
// also tried :-(:
//return view('admin.opgave', compact('tasks'));
}
//opgive.blade.php
@foreach ($opgaver as $opgave)
// here is a table, and then comes the Action
<a href="{{ route('opgave.edit', $opgave->id) }}"
data-toggle="modal"
data-target="#RetOpgave"
class="btn btn-primary btn-xs">Edit</a>
@endforeach
@foreach($opgaver作为$opgive)
//这是一张桌子,然后是动作
@endforeach
//在opgive.blade.php的底部
//@include('admin.opgaver.opgaveRet')
&时代;
Ret Opgive
@如果(!空($tasks))
//在这里,我想构建一个表单::
//但是$tasks里面什么都没有???????
{{dd($tasks)}
@恩迪夫
陆克文
您必须在AJAX中调用编辑函数
这个可以帮助你:
谢谢你的链接,它看起来像是我可以使用的东西。谢谢!
<div class="modal fade" id="RetOpgave" tabindex="-1" role="dialog" aria-labelledby="RetOpgave">
<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="modal-title" id="RetOpgave">Ret opgave</h4>
</div>
<div class="modal-body" >
@if(!empty($tasks))
// Here i want to build a FORM::
// But there is nothing in $tasks ???????
{{ dd($tasks) }}
@endif
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Luk</button>
</div>
</div>
</div>
</div>