0
私の詳細の出力を表示する方法。自分のコードやLaravelのデータベースに何か問題がありますか?私の詳細の出力を表示しません
データベース
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDetailsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('details', function (Blueprint $table) {
$table->increments('id');
$table->text('price');
$table->text('quantity');
$table->timestamp('returned_at');
$table->timestamps();
$table->integer('video_id')->unsigned();
$table->foreign('video_id')
->on('videos')
->references('id')
->onUpdate('cascade')
->onDelete('restrict');
$table->integer('transaction_id')->unsigned();
$table->foreign('transaction_id')
->on('rentals')
->references('id')
->onUpdate('cascade')
->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('details');
}
}
私はそれにモーダルを使用しています。この1。
Index.blade.php - 詳細
@section('content')
<html>
<head>
<div class="row">
<h1 class="page-header">Details</h1>
<div class="col-md-12">
<table class="table">
<thead>
<tr>
<th>Video ID</th>
<th>Price </th>
<th>Returned at</th>
<th>View</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
@foreach($details as $x => $detail)
<tr>
<td>{{ $detail->video_id }}</td>
<td>{{ $detail->total_amount }}</td>
<td>{{ $detail->returned_at }}</td>
<td><button type="button" class="btn btn-info" data-toggle="modal" data-target="#viewren{{ $x }}">View</button>
<div id="viewren{{ $x }}" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h1 class="page-header">Transaction: {{$detail->id}}</h1>
<center><div class="modal-body">
<div class="row">
<div class="col-md-12">
<dl class="dl-horizontal">
<dt>ID:</dt><dd>{{ $detail->video_id }}</dd>
<dt>Rented at:</dt><dd>{{ $detail->price }}</dd>
<dt>Total Amount:</dt><dd>{{ $detail->quantity }}</dd>
<dt>Interest Amount:</dt><dd>{{ $detail->status }}</dd>
<dt>Interest Amount:</dt><dd>{{ $detail->returned_at }}</dd>
</dl>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-bordered">
<thead>
<tr>
<td>Video</td>
<td>Status</td>
<td>Returned Date</td>
</tr>
</thead>
<tbody>
@foreach($rental->details as $v)
<tr>
<td>{{ $v->video->title }}</td>
<td>{{ $v->status }}</td>
<td>{{ $v->returned_at }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</td>
<td><a class="btn btn-primary" href="{{ action('[email protected]', $rental->id) }}">Edit</a></td>
<td>
@include('detail.delete')
</td>
@endforeach
</tr>
<div class="parallax"></div>
</tbody>
</thead>
</table>
</div>
</div>
@endsection
私はあなたがこれで私を助けることができると思います。 ありがとうございます。