{"action":"created","issue":{"url":"https://api.github.com/repos/owen-it/laravel-auditing/issues/27","repository_url":"https://api.github.com/repos/owen-it/laravel-auditing","labels_url":"https://api.github.com/repos/owen-it/laravel-auditing/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/owen-it/laravel-auditing/issues/27/comments","events_url":"https://api.github.com/repos/owen-it/laravel-auditing/issues/27/events","html_url":"https://github.com/owen-it/laravel-auditing/issues/27","id":130837812,"number":27,"title":"Logs collection does not update upon deleting an object","user":{"login":"abodnar","id":1891200,"avatar_url":"https://avatars.githubusercontent.com/u/1891200?v=3","gravatar_id":"","url":"https://api.github.com/users/abodnar","html_url":"https://github.com/abodnar","followers_url":"https://api.github.com/users/abodnar/followers","following_url":"https://api.github.com/users/abodnar/following{/other_user}","gists_url":"https://api.github.com/users/abodnar/gists{/gist_id}","starred_url":"https://api.github.com/users/abodnar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abodnar/subscriptions","organizations_url":"https://api.github.com/users/abodnar/orgs","repos_url":"https://api.github.com/users/abodnar/repos","events_url":"https://api.github.com/users/abodnar/events{/privacy}","received_events_url":"https://api.github.com/users/abodnar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-02T22:22:15Z","updated_at":"2016-02-03T16:36:10Z","closed_at":null,"body":"While working on some code where I'm using this package, I found that if I delete an object the log collection does not update to contain a log entry for the deletion. This may be expected, but I wanted to be sure. I have soft deletes on my object, so maybe that has something to do with it. Though I do know it's logging the deleting in the logs table.\r\n\r\n```\r\n$obj = new Obj();\r\n$obj->title = 'title';\r\n$result = $obj->save();\r\n$this->assertEquals(1, $result, 'Expecting id of 1 after first record created');\r\n\r\n$log = $obj->logs()->first();\r\n$this->assertNotEmpty($log, 'Expected a log entry for the creation of the obj');\r\n\r\n$obj->title = 'Updated title';\r\n$obj->save();\r\n\r\n$logs = $obj->logs;\r\n$this->assertCount(2, $logs, 'Expected two log entries after changing the title of the obj');\r\n\r\nobj->delete();\r\n$logs = $obj->logs;\r\n\r\necho count($logs); // = 2\r\n```\r\n\r\nAlso I found that I get an error when trying to use logs()->last().\r\n\r\nBadMethodCallException: Call to undefined method Illuminate\\Database\\Query\\Builder::last()\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/owen-it/laravel-auditing/issues/comments/179329120","html_url":"https://github.com/owen-it/laravel-auditing/issues/27#issuecomment-179329120","issue_url":"https://api.github.com/repos/owen-it/laravel-auditing/issues/27","id":179329120,"user":{"login":"abodnar","id":1891200,"avatar_url":"https://avatars.githubusercontent.com/u/1891200?v=3","gravatar_id":"","url":"https://api.github.com/users/abodnar","html_url":"https://github.com/abodnar","followers_url":"https://api.github.com/users/abodnar/followers","following_url":"https://api.github.com/users/abodnar/following{/other_user}","gists_url":"https://api.github.com/users/abodnar/gists{/gist_id}","starred_url":"https://api.github.com/users/abodnar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abodnar/subscriptions","organizations_url":"https://api.github.com/users/abodnar/orgs","repos_url":"https://api.github.com/users/abodnar/repos","events_url":"https://api.github.com/users/abodnar/events{/privacy}","received_events_url":"https://api.github.com/users/abodnar/received_events","type":"User","site_admin":false},"created_at":"2016-02-03T16:36:10Z","updated_at":"2016-02-03T16:36:10Z","body":"Here is my model.\r\n\r\n```\r\n<?php\r\n\r\nnamespace App;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\nuse OwenIt\\Auditing\\AuditingTrait;\r\n\r\nclass Obj extends Model\r\n{\r\n    use AuditingTrait;\r\n\r\n    /**\r\n     * The attributes that are mass assignable.\r\n     *\r\n     * @var array\r\n     */\r\n    protected $fillable = [\r\n        'title'\r\n    ];\r\n\r\n    /**\r\n     * The attributes excluded from the model's JSON form.\r\n     *\r\n     * @var array\r\n     */\r\n    protected $hidden = [\r\n    ];\r\n\r\n    /**\r\n     * The attributes to exclude in logging for audit logging\r\n     *\r\n     * @var array\r\n     */\r\n    protected $dontKeepLogOf = [\r\n        'created_at',\r\n        'updated_at'\r\n    ];\r\n}\r\n````"}}