-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part 17 - Model/Form binding and creating an update form
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.btn-h1-spacing { | ||
margin-top: 18px; | ||
} | ||
|
||
.form-spacing-top { | ||
margin-top: 30px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@extends('main') | ||
|
||
@section('title', '| Edit Blog Post') | ||
|
||
@section('content') | ||
|
||
<div class="row"> | ||
{!! Form::model($post, ['route' => ['posts.update', $post->id]]) !!} | ||
<div class="col-md-8"> | ||
{{ Form::label('title', 'Title:') }} | ||
{{ Form::text('title', null, ["class" => 'form-control input-lg']) }} | ||
|
||
{{ Form::label('body', "Body:", ['class' => 'form-spacing-top']) }} | ||
{{ Form::textarea('body', null, ['class' => 'form-control']) }} | ||
</div> | ||
|
||
<div class="col-md-4"> | ||
<div class="well"> | ||
<dl class="dl-horizontal"> | ||
<dt>Created At:</dt> | ||
<dd>{{ date('M j, Y h:ia', strtotime($post->created_at)) }}</dd> | ||
</dl> | ||
|
||
<dl class="dl-horizontal"> | ||
<dt>Last Updated:</dt> | ||
<dd>{{ date('M j, Y h:ia', strtotime($post->updated_at)) }}</dd> | ||
</dl> | ||
<hr> | ||
<div class="row"> | ||
<div class="col-sm-6"> | ||
{!! Html::linkRoute('posts.show', 'Cancel', array($post->id), array('class' => 'btn btn-danger btn-block')) !!} | ||
</div> | ||
<div class="col-sm-6"> | ||
{!! Html::linkRoute('posts.update', 'Save Changes', array($post->id), array('class' => 'btn btn-success btn-block')) !!} | ||
</div> | ||
</div> | ||
|
||
</div> | ||
</div> | ||
{!! Form::close() !!} | ||
</div> <!-- end of .row (form) --> | ||
|
||
@stop |