Skip to content

Instantly share code, notes, and snippets.

@aavrug
Created June 10, 2015 07:05
Show Gist options
  • Save aavrug/4a9330c28a1f01bdb524 to your computer and use it in GitHub Desktop.
Save aavrug/4a9330c28a1f01bdb524 to your computer and use it in GitHub Desktop.
index of postcontroller in Laravel5
@extends('app')
@section('content')
{!! link_to('posts/create', 'Add Post', ['class' => 'btn btn-primary']) !!}
@if ($posts)
<hr/>
<table class="table table-bordered table-striped table-hover">
<tr>
<th>Title</th>
<th>Description</th>
<th>Published on</th>
<th>Action</th>
</tr>
@foreach ($posts as $post)
<tr>
<td>{!! link_to_action('PostsController@show', $post->title, $parameters = array($post->id)) !!}</td>
<td>{!! $post->description !!}</td>
<td>{!! $post->published_at !!}</td>
<td>{!! link_to_action('PostsController@edit', 'Edit Post', $parameters = array($post->id), $attributes = ['class' => 'btn btn-warning']) !!} {!! link_to_action('PostsController@destroy', 'Delete', $parameters = array($post->id), $attributes = ['class' => 'btn btn-danger']) !!}</td>
</tr>
@endforeach
</table>
@endif
@stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment