Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build
composer.lock
docs
vendor
.idea
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ This package automatically inserts/updates an audit log on your table on who cre
composer require yajra/laravel-auditable
```

## Publish config file

If you want to modify the `withDefault` option on auditable columns, you may publish the config file.

```bash
php artisan vendor:publish --tag=auditable
```

## Usage

Update your model's migration and add `created_by` and `updated_by` field using the `auditable()` blueprint macro.
Expand Down
3 changes: 2 additions & 1 deletion src/AuditableWithDeletesTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public static function bootAuditableWithDeletesTrait()
*/
public function deleter()
{
return $this->belongsTo($this->getUserClass(), $this->getDeletedByColumn())->withDefault();
return $this->belongsTo($this->getUserClass(), $this->getDeletedByColumn())
->withDefault(config('auditable.defaults.deleter'));
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/config/auditable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@
'name' => '',
// add updater default values if not set
],

'deleter' => [
'name' => '',
// add deleter default values if not set
],
],
];