-
Notifications
You must be signed in to change notification settings - Fork 49
Bootstrap CRUD
JP Barbosa edited this page Mar 11, 2016
·
3 revisions
nano resources/views/articles/form.blade.php
<div class="form-group">
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('content', 'Content:') !!}
{!! Form::textArea('content', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('author_id', 'Author:') !!}
{!! Form::select('author_id', $authors, $article->author_id, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit($submitButtonText, ['class' => 'btn btn-primary']) !!}
</div>
nano resources/views/authors/form.blade.php
<div class="form-group">
{!! Form::label('name', 'Name:') !!}
{!! Form::text('name', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('email', 'E-mail:') !!}
{!! Form::text('email', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit($submitButtonText, ['class' => 'btn btn-primary']) !!}
</div>
nano resources/views/articles/index.blade.php
@extends($layout)
@section('content')
<h1>Articles</h1>
{!! link_to_route('articles.create', 'New Article', null, ['class' => 'btn btn-primary btn-lg']) !!}
<table class="table">
<tr>
<th>Edit</th>
<th>Delete</th>
<th>Title</th>
<th>Author</th>
</tr>
@foreach ($articles as $article)
<tr>
<td>{!! link_to_route('articles.edit', 'Edit', $article->id, ['class' => 'btn btn-default']) !!}</td>
<td>
{!! Form::open(['method' => 'DELETE', 'route' => ['articles.destroy', $article->id]]) !!}
<button type="submit" class="btn btn-warning">Delete</button>
{!! Form::close() !!}
</td>
<td>{!! link_to_route('articles.show', $article->title, $article->id) !!}</td>
<td>{!! $article->author->name !!}</td>
</tr>
@endforeach
</table>
@endsection
nano resources/views/authors/index.blade.php
@extends($layout)
@section('content')
<h1>Authors</h1>
{!! link_to_route('authors.create', 'New Author', null, ['class' => 'btn btn-primary btn-lg']) !!}
<table class="table">
<tr>
<th>Edit</th>
<th>Delete</th>
<th>Name</th>
</tr>
@foreach ($authors as $author)
<tr>
<td>{!! link_to_route('authors.edit', 'Edit', $author->id, ['class'=> 'btn btn-default']) !!}</td>
<td>
{!! Form::open(['method' => 'DELETE', 'route' => ['authors.destroy', $author->id]]) !!}
<button type="submit" class="btn btn-warning">Delete</button>
{!! Form::close() !!}
</td>
<td>{!! link_to_route('authors.show', $author->name, $author->id) !!}</td>
</tr>
@endforeach
</table>
@endsection
php artisan serve
open http://localhost:8000/articles
open http://localhost:8000/articles/create
git add .
git commit -m "Add Bootstrap to CRUD views"
Next step: Alerts
- Setup
- Basic CRUD
- Validation
- Views
- Association
- Association Controller
- Association Views
- Basic Template
- Bootstrap
- Bootstrap CRUD
- Alerts
- Welcome Page
- Ajax CRUD
- Send Email
- Send Email Views
- Jobs Queue
- Captcha
- Async External Content
- Cached External Content
- Tests Setup
- Functional Tests
- Acceptance Tests
- Continuous Integration
- Deploy with Heroku
- Deploy with Forge
- Update README