Skip to content

Commit

Permalink
Create New Post view
Browse files Browse the repository at this point in the history
  • Loading branch information
smoisset committed Sep 10, 2017
1 parent 43e76f0 commit 4920fbb
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function index()
*/
public function create()
{
//
return view('posts.create');
}

/**
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0"
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4.0"
},
"require-dev": {
"filp/whoops": "~2.0",
Expand Down
67 changes: 66 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
/*
* Package Service Providers...
*/
Collective\Html\HtmlServiceProvider::class,

/*
* Application Service Providers...
Expand Down Expand Up @@ -206,8 +207,10 @@
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Form' => Collective\Html\FormFacade::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Html' => Collective\Html\HtmlFacade::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
Expand Down
24 changes: 24 additions & 0 deletions resources/views/posts/create.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@extends('main')

@section('title', '| Create New Post')

@section('content')

<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1>Create New Post</h1>
<hr>

{!! Form::open(['route' => 'posts.store']) !!}
{{ Form::label('title', 'Title:') }}
{{ Form::text('title', null, array('class' => 'form-control', 'style' => 'margin-bottom: 20px;')) }}

{{ Form::label('body', 'Post Body:') }}
{{ Form::textarea('body', null, array('class' => 'form-control'))}}

{{ Form::submit('Create Post', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top: 20px;')) }}
{!! Form::close() !!}
</div>
</div>

@endsection
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
Route::get('about', 'PagesController@getAbout');
Route::get('/', 'PagesController@getIndex');

Route::resource('post', 'PostController');
Route::resource('posts', 'PostController');

0 comments on commit 4920fbb

Please sign in to comment.