Permalink
Browse files

Restore Laravel 5.1 LTS compatibility (#104)

* Add Laravel 5.1 LTS compatibility

* Raised minimum versions for tests to pass with --prefer-lowest
  • Loading branch information...
1 parent ce43394 commit 9367f8010fe194592813a0b199ca7ae2b9f2633b @hackel hackel committed with freekmurze Nov 26, 2016
Showing with 18 additions and 9 deletions.
  1. +7 −6 composer.json
  2. +1 −1 config/laravel-activitylog.php
  3. +5 −1 src/ActivityLogger.php
  4. +5 −1 tests/TestCase.php
View
@@ -26,16 +26,16 @@
],
"require": {
"php" : "^7.0",
- "illuminate/config": "~5.2.0|~5.3.0",
- "illuminate/database": "~5.2.6|~5.3.0",
- "illuminate/support": "~5.2.0|~5.3.0",
+ "illuminate/config": "~5.1.24|~5.2.0|~5.3.0",
+ "illuminate/database": "~5.1.24|~5.2.6|~5.3.0",
+ "illuminate/support": "~5.1.24|~5.2.0|~5.3.0",
"spatie/string": "^2.1"
},
"require-dev": {
- "phpunit/phpunit": "5.*",
- "orchestra/testbench": "3.3.x-dev",
- "orchestra/database": "3.3.x-dev"
+ "phpunit/phpunit": "~5.2",
+ "orchestra/testbench": "~3.1.2|3.3.x-dev",
+ "orchestra/database": "~3.1.2|3.3.x-dev"
},
"autoload": {
"psr-4": {
@@ -50,6 +50,7 @@
"Spatie\\Activitylog\\Test\\": "tests"
}
},
+
"scripts": {
"test": "vendor/bin/phpunit"
},
@@ -28,7 +28,7 @@
/*
* If set to true, the subject returns soft deleted models.
*/
- 'subject_returns_soft_deleted_models' => false,
+ 'subject_returns_soft_deleted_models' => false,
/*
* This model will be used to log activity. The only requirement is that
@@ -38,7 +38,11 @@ public function __construct(AuthManager $auth, Repository $config)
$authDriver = $config['laravel-activitylog']['default_auth_driver'] ?? $auth->getDefaultDriver();
- $this->causedBy = $auth->guard($authDriver)->user();
+ if (starts_with(app()->version(), '5.1')) {
+ $this->causedBy = $auth->driver($authDriver)->user();
+ } else {
+ $this->causedBy = $auth->guard($authDriver)->user();
+ }
$this->logName = $config['laravel-activitylog']['default_log_name'];
View
@@ -46,7 +46,11 @@ public function getEnvironmentSetUp($app)
'prefix' => '',
]);
- $app['config']->set('auth.providers.users.model', User::class);
+ if (starts_with($app->version(), '5.1')) {
+ $app['config']->set('auth.model', User::class);
+ } else {
+ $app['config']->set('auth.providers.users.model', User::class);
+ }
$app['config']->set('app.key', '6rE9Nz59bGRbeMATftriyQjrpF7DcOQm');
}

0 comments on commit 9367f80

Please sign in to comment.