Skip to content

Commit

Permalink
psr2
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Aug 10, 2016
1 parent d6ab810 commit 1f5a137
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All Notable changes to `spatie/laravel-activitylog` will be documented in this file

## 1.4.0 - 2016-08-10
- Added support for soft deletes

## 1.3.2 - 2016-08-09
- This version replaces version `1.3.0`
- Dropped L5.1 compatibility
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ return [
/**
* When set to true, the subject returns soft deleted models
*/
'subject_withTrashed' => false
'subject_returns_soft_deleted_models' => false
];
```

Expand Down
2 changes: 1 addition & 1 deletion config/laravel-activitylog.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
/**
* When set to true, the subject returns soft deleted models
*/
'subject_withTrashed' => false,
'subject_returns_soft_deleted_models' => false,
];
6 changes: 4 additions & 2 deletions src/Models/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class Activity extends Eloquent

public function subject(): MorphTo
{
if (config('laravel-activitylog.subject_withTrashed'))
return $this->morphTo()->withTrashed();
if (config('laravel-activitylog.subject_returns_soft_deleted_models')) {
return $this->morphTo()->withTrashed();
}

return $this->morphTo();
}

Expand Down
6 changes: 3 additions & 3 deletions tests/LogsActivityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public function it_can_fetch_all_activity_for_a_model()
}

/** @test */
public function it_can_fetch_all_activity_for_a_deleted_model()
public function it_can_fetch_soft_deleted_models()
{
$this->app['config']->set('laravel-activitylog.subject_withTrashed', true);
$this->app['config']->set('laravel-activitylog.subject_returns_soft_deleted_models', true);

$article = $this->createArticle();

$article->name = 'changed name';
Expand Down
2 changes: 1 addition & 1 deletion tests/Models/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Article extends Model
{
use SoftDeletes;

protected $table = 'articles';

protected $guarded = [];
Expand Down

0 comments on commit 1f5a137

Please sign in to comment.