From 4920fbb786c9da355a3bc8f47651d14f5d1bb51e Mon Sep 17 00:00:00 2001 From: smoisset Date: Sun, 10 Sep 2017 23:00:03 +0100 Subject: [PATCH] Create New Post view --- app/Http/Controllers/PostController.php | 2 +- composer.json | 3 +- composer.lock | 67 ++++++++++++++++++++++++- config/app.php | 3 ++ resources/views/posts/create.blade.php | 24 +++++++++ routes/web.php | 2 +- 6 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 resources/views/posts/create.blade.php diff --git a/app/Http/Controllers/PostController.php b/app/Http/Controllers/PostController.php index 4e5145d..53a2733 100644 --- a/app/Http/Controllers/PostController.php +++ b/app/Http/Controllers/PostController.php @@ -23,7 +23,7 @@ public function index() */ public function create() { - // + return view('posts.create'); } /** diff --git a/composer.json b/composer.json index 6ba7fc2..9c084bc 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/composer.lock b/composer.lock index 710bfb7..96d5975 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "8f2120fa77d42a42b4210cdbe1c114e2", + "content-hash": "0bc40d92d88ec41475297fde0cd510b3", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -598,6 +598,71 @@ ], "time": "2017-07-13T13:11:05+00:00" }, + { + "name": "laravelcollective/html", + "version": "v5.5.1", + "source": { + "type": "git", + "url": "https://github.com/LaravelCollective/html.git", + "reference": "2f6dc39ab3655724a615fe8a652d8b7f04fc9ac6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/2f6dc39ab3655724a615fe8a652d8b7f04fc9ac6", + "reference": "2f6dc39ab3655724a615fe8a652d8b7f04fc9ac6", + "shasum": "" + }, + "require": { + "illuminate/http": "5.5.*", + "illuminate/routing": "5.5.*", + "illuminate/session": "5.5.*", + "illuminate/support": "5.5.*", + "illuminate/view": "5.5.*", + "php": ">=7.0.0" + }, + "require-dev": { + "illuminate/database": "5.5.*", + "mockery/mockery": "~0.9.4", + "phpunit/phpunit": "~5.4" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Collective\\Html\\HtmlServiceProvider" + ], + "aliases": { + "Form": "Collective\\Html\\FormFacade", + "Html": "Collective\\Html\\HtmlFacade" + } + } + }, + "autoload": { + "psr-4": { + "Collective\\Html\\": "src/" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + }, + { + "name": "Adam Engebretson", + "email": "adam@laravelcollective.com" + } + ], + "description": "HTML and Form Builders for the Laravel Framework", + "homepage": "http://laravelcollective.com", + "time": "2017-08-31T14:46:03+00:00" + }, { "name": "league/flysystem", "version": "1.0.41", diff --git a/config/app.php b/config/app.php index 0e4ebed..c481c46 100644 --- a/config/app.php +++ b/config/app.php @@ -167,6 +167,7 @@ /* * Package Service Providers... */ + Collective\Html\HtmlServiceProvider::class, /* * Application Service Providers... @@ -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, diff --git a/resources/views/posts/create.blade.php b/resources/views/posts/create.blade.php new file mode 100644 index 0000000..ab5ca89 --- /dev/null +++ b/resources/views/posts/create.blade.php @@ -0,0 +1,24 @@ +@extends('main') + +@section('title', '| Create New Post') + +@section('content') + +
+
+

Create New Post

+
+ + {!! 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() !!} +
+
+ +@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 93a4b81..f8696a6 100644 --- a/routes/web.php +++ b/routes/web.php @@ -15,4 +15,4 @@ Route::get('about', 'PagesController@getAbout'); Route::get('/', 'PagesController@getIndex'); -Route::resource('post', 'PostController'); \ No newline at end of file +Route::resource('posts', 'PostController'); \ No newline at end of file