Index.blade.php code
@extends('layouts.master')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-6">
<h2>entrevistas </h2>
<table class="table table-striped">
<tr>
<th>nombre_entrevista</th>
<th>duracion_entrevista</th>
<th>bloque_entrevista</th>
<th>Opciones</th>
</tr>
@foreach($entrevista as $entrevistas)
<tr>
<td>{{$entrevistas['nombre_entrevista']}}</td>
<td>{{$entrevistas['duracion_entrevista']}}</td>
<td>{{$entrevistas['bloque_entrevista']}}</td>
<td>
<a href="{{route('entrevista_editar', ['id' => $entrevistas['id']])}}" class="btn btn-default">Editar</a>
<a href="{{route('entrevista_eliminar', ['id' => $entrevistas['id']])}}" class="btn btn-danger"">Eliminar</a>
</td>
</tr>
@endforeach
</table>
</div>
</div>
</div>
@stop
Interview Controller
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Noticia;
use App\Entrevista;
use Input;
use Redirect;
class entrevistaController extends Controller
{
public function index($id){
$entrevista = Entrevista::get();
$entrevista = Noticia::find($id)->entrevistas;
return view('entrevista/index', ['entrevista' => $entrevista]);
}
public function show($id)
{
$entrevista = new Entrevista;
$entrevistas = $entrevista->find($id);
$noticias = Noticia::get();
return view('entrevista/editar', ['entrevista' => $entrevistas], ['noticias' => $noticias] );
}
Routes
Route::get('entrevista/editar/{id}',
'EntrevistaController@show')->name('entrevista_editar');
Route::post('entrevista/editar/{id}', 'EntrevistaController@update');
Route::get('entrevista/eliminar/{id}',
'EntrevistaController@destroy')->name('entrevista_eliminar');
Route::post('/noticia/nuevo',
'NoticiaController@store')->name('nuevo_noticia');
Route::get('/noticia/nuevo', function () {
return view('/noticia/nuevo');
});
Route::post('/nota/nuevo', 'NotaController@store')->name('nota_noticia');
Route::get('/nota/nuevo', 'NotaController@listar');
Route::post('/entrevista/nuevo', 'EntrevistaController@store')->name('entrevista_noticia');
Route::get('/entrevista/nuevo', 'EntrevistaController@listar');