Skip to content

Commit

Permalink
Update to support Laravel 5.4 (#321)
Browse files Browse the repository at this point in the history
* chnaged getToken() to token() to support laravel 5.4

* added backward compatibility with Laravel < 5.4

* pass PSR-2 validation
  • Loading branch information
daryledesilva authored and PatrickRose committed Apr 2, 2017
1 parent a0d0689 commit 52cffc6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
Expand Up @@ -180,7 +180,7 @@ class BootstrapperServiceProvider extends ServiceProvider
$form = new Form(
$app['html'],
$app['url'],
$app['session.store']->getToken()
(method_exists($app['session.store'], 'getToken') ? $app['session.store']->getToken() : $app['session.store']->token())
);

return $form->setSessionStore($app['session.store']);
Expand Down
2 changes: 1 addition & 1 deletion docs/files/BootstrapperServiceProvider.php.txt
Expand Up @@ -138,7 +138,7 @@ class BootstrapperServiceProvider extends ServiceProvider
$form = new Form(
$app['html'],
$app['url'],
$app['session.store']->getToken()
(method_exists($app['session.store'], 'getToken') ? $app['session.store']->getToken() : $app['session.store']->token())
);

return $form->setSessionStore($app['session.store']);
Expand Down
3 changes: 2 additions & 1 deletion src/Bootstrapper/BootstrapperL5ServiceProvider.php
Expand Up @@ -203,11 +203,12 @@ function ($app) {
$this->app->bind(
'bootstrapper::form',
function ($app) {
$tokenMethod = method_exists($app['session.store'], 'getToken') ? 'getToken' : 'token';
$form = new Form(
$app->make('collective::html'),
$app->make('url'),
$app->make('view'),
$app['session.store']->getToken()
$app['session.store']->$tokenMethod()
);

return $form->setSessionStore($app['session.store']);
Expand Down
Expand Up @@ -96,6 +96,7 @@ public function make($abstract, $parameters = array())
case 'session.store':
$mock = \Mockery::mock('Illuminate\\Session\\Store');
$mock->shouldReceive('getToken');
$mock->shouldReceive('token');
return $mock;
case 'files':
$mock = \Mockery::mock('Files');
Expand Down

0 comments on commit 52cffc6

Please sign in to comment.