Skip to content

Merge Incompatible Laravel 5.2 Changes #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Using [@stidges](https://github.com/stidges)' code for bootstrap forms to create a composer package. You can find the original article here: http://blog.stidges.com/post/easy-bootstrap-forms-in-laravel

Note this is not compatible with Laravel < 5.2.

## Install

```
Expand All @@ -10,19 +12,17 @@ composer require manavo/laravel-bootstrap-forms ~0.1

## Configure

Make sure you comment out the existing HtmlServiceProvider (Illuminate\Html\HtmlServiceProvider):
Make sure you comment out the existing HtmlServiceProvider (Collectve\Html\HtmlServiceProvider):

```php
<?php
// File (Laravel 4): app/config/app.php
// OR
// File (Laravel 5): config/app.php

return array(
// ...
'providers' => array(
// ...
// 'Illuminate\Html\HtmlServiceProvider',
// 'Collective\Html\HtmlServiceProvider',
'Manavo\BootstrapForms\BootstrapFormsServiceProvider',
// ...
),
Expand All @@ -35,15 +35,15 @@ No change is necessary for the Form Facade.
## Example

```
{{ Form::open([ 'route' => 'posts.store' ]) }}
{!! Form::open([ 'route' => 'posts.store' ]) !!}

{{ Form::openGroup('title', 'Title') }}
{{ Form::text('title') }}
{{ Form::closeGroup() }}
{!! Form::openGroup('title', 'Title') !!}
{!! Form::text('title') !!}
{!! Form::closeGroup() !!}

{{ Form::openGroup('status', 'Status') }}
{{ Form::select('status', $statusOptions) }}
{{ Form::closeGroup() }}
{!! Form::openGroup('status', 'Status') !!}
{!! Form::select('status', $statusOptions) !!}
{!! Form::closeGroup() !!}

{{ Form::close() }}
{!! Form::close() !!}
```
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@
{
"name": "Philip Manavopoulos",
"email": "[email protected]"
},
{
"name": "David Lloyd",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.4.0"
"php": ">=5.4.0",
"laravelcollective/html": "5.2.*"
},
"autoload": {
"psr-0": {
Expand Down
8 changes: 4 additions & 4 deletions src/Manavo/BootstrapForms/BootstrapFormsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace Manavo\BootstrapForms;

use Illuminate\Html\HtmlServiceProvider as IlluminateHtmlServiceProvider;
use Collective\Html\HtmlServiceProvider as CollectiveHtmlServiceProvider;

class BootstrapFormsServiceProvider extends IlluminateHtmlServiceProvider
class BootstrapFormsServiceProvider extends CollectiveHtmlServiceProvider
{

/**
Expand Down Expand Up @@ -32,9 +32,9 @@ public function boot()
*/
public function registerFormBuilder()
{
$this->app->bindShared('form', function ($app) {
$this->app->singleton('form', function ($app) {
$form = new FormBuilder($app['html'], $app['url'],
$app['session.store']->getToken());
$app['view'], $app['session.store']->getToken());

return $form->setSessionStore($app['session.store']);
});
Expand Down
4 changes: 2 additions & 2 deletions src/Manavo/BootstrapForms/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Manavo\BootstrapForms;

use Illuminate\Html\FormBuilder as IlluminateFormBuilder;
use Collective\Html\FormBuilder as CollectiveFormBuilder;

class FormBuilder extends IlluminateFormBuilder
class FormBuilder extends CollectiveFormBuilder
{

/**
Expand Down