Php 在laravel中将数据从一个视图传递到另一个视图
按下“Edytuj”按钮时,我需要将信息从视图传递到另一个视图 这是我的SlideControl(第二视图) 我的路线Php 在laravel中将数据从一个视图传递到另一个视图,php,laravel,laravel-blade,Php,Laravel,Laravel Blade,按下“Edytuj”按钮时,我需要将信息从视图传递到另一个视图 这是我的SlideControl(第二视图) 我的路线 Route::get('index/createpresentation','DataController@createpresentation'); Route::post('index/','DataController@storepresentation'); Route::get('index/delete/{ID}','DataController@delet
Route::get('index/createpresentation','DataController@createpresentation');
Route::post('index/','DataController@storepresentation');
Route::get('index/delete/{ID}','DataController@deletepresentation');
Route::get('index/edit/{ID}','SlideController@slideindex');
Route::get('index/','DataController@index');
Route::get('index/slideindex','SlideController@slideindex');
第二视图的刀片
@extends('template')
@section('title'){{@title}} @endsection
@section('content')
<nav class="navbar fixed-top navbar-expand-lg navbar-light bg-light">
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="/index">Index <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active">
<a class="nav-link" href="">Dodaj slajd <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active">
<span class="navbar-brand ">Presentation Name</span>
</li>
</ul>
</div>
</nav>
<div class="container">
<table class="table table-hover">
<thead>
<tr>
<th>Id</th>
<th>Nazwa</th>
<th>Typ</th>
<th>Akcja</th>
</tr>
</thead>
<tbody>
@foreach ($slidesList as $slides )
<tr>
<th scope="row">{{$slides ->id}}</th>
<td>{{$slides->slideName}}</td>
<td>{{$slides->type}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection('content')
@extends('template'))
@节('title'){{@title}}@endsection
@节(“内容”)
-
-
-
演示文稿名称
身份证件
纳兹瓦
类型
阿克贾
@foreach($slideslistas$slides)
{{$slides->id}
{{$slides->slideName}
{{$slides->type}
@endforeach
@endsection('内容')
有两种方法可以尝试
- 使用所需的所有值在表单之间过帐数据
- 使用jquery/js将表单连接在一起并在它们之间切换 功能
- 将这些值以某种形式存储在reddis或db中,以便重复使用
- 使用所需的所有值在表单之间过帐数据
- 使用jquery/js将表单连接在一起并在它们之间切换 功能
- 将这些值以某种形式存储在reddis或db中,以便重复使用
- 有几种方法可以尝试
public function show($id)
{
// logic here
}
web.php
Route::get('/{id}', 'controller@show')->name('show.edit.form');
然后,您可以在forloop中创建一个链接:
@foreach ($slidesList as $slides )
<tr>
<th scope="row">{{$slides ->id}}</th>
<td>{{$slides->slideName}}</td>
<td>{{$slides->type}}</td>
<td><a href="{{ route('show.edit.form', $slides->id) }}">EDIT</a></td>
</tr>
@endforeach
然后,如果将演示文稿传递给视图,则可以执行以下操作:
@foreach ($presentation->slides as $slide)
// logic here
@endforeach
我想您要传递要编辑的行的ID吗 您可以为此创建路由和控制器 例如: controller.php
public function show($id)
{
// logic here
}
web.php
Route::get('/{id}', 'controller@show')->name('show.edit.form');
然后,您可以在forloop中创建一个链接:
@foreach ($slidesList as $slides )
<tr>
<th scope="row">{{$slides ->id}}</th>
<td>{{$slides->slideName}}</td>
<td>{{$slides->type}}</td>
<td><a href="{{ route('show.edit.form', $slides->id) }}">EDIT</a></td>
</tr>
@endforeach
然后,如果将演示文稿传递给视图,则可以执行以下操作:
@foreach ($presentation->slides as $slide)
// logic here
@endforeach
我需要将ID所关联的名称(nazwa prezentacji)传递到我指出的位置,在第二个视图中,我不确定你想要实现什么。演示文稿上的外键是名称吗?简而言之,第一个视图用于演示文稿,第二个视图用于该演示文稿中的幻灯片。因此,我需要该幻灯片的共同响应名称。我想我会在ID上加上foreing键,这样我就可以将结果分组到一个ID上,该ID需要在这里,