{"action":"opened","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/23425","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/23425/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/23425/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/23425/events","html_url":"https://github.com/laravel/framework/issues/23425","id":303130872,"number":23425,"title":"Laravel Model Events are not detecting soft delet items","user":{"login":"mubbi","id":6255767,"avatar_url":"https://avatars1.githubusercontent.com/u/6255767?v=4","gravatar_id":"","url":"https://api.github.com/users/mubbi","html_url":"https://github.com/mubbi","followers_url":"https://api.github.com/users/mubbi/followers","following_url":"https://api.github.com/users/mubbi/following{/other_user}","gists_url":"https://api.github.com/users/mubbi/gists{/gist_id}","starred_url":"https://api.github.com/users/mubbi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mubbi/subscriptions","organizations_url":"https://api.github.com/users/mubbi/orgs","repos_url":"https://api.github.com/users/mubbi/repos","events_url":"https://api.github.com/users/mubbi/events{/privacy}","received_events_url":"https://api.github.com/users/mubbi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-07T14:57:47Z","updated_at":"2018-03-07T14:57:47Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nPlease use this issue tracker only for reporting Laravel bugs.\r\n\r\nIf you need support, please use the forums:\r\n\r\n- https://laracasts.com/discuss \r\n- https://laravel.io/forum\r\n\r\nAlternatively, you may use Slack (https://larachat.co/) or Stack Overflow (http://stackoverflow.com/questions/tagged/laravel).\r\n\r\nIf you would like to propose new Laravel features, please make a pull request, or open an issue at https://github.com/laravel/internals/issues.\r\n-->\r\n\r\n- Laravel Version: 3.6.5\r\n- PHP Version: 7.1.7\r\n- Database Driver & Version:  libmysql - mysqlnd 5.0.12-dev - 20150407\r\n\r\n### Description:\r\nAs in general in eloquent queries, Laravel automatically ignore the soft deleted items and fetch only those items which are not soft deleted. According to the eloquent model Event the \"deleting\" and \"deleted\" events are triggered when we do a soft delete or permanent delete.\r\nAnd i just found that in these events the eloquent is not automatically detecting soft delete and ignore soft deleted items. Which results in that like if we want to run an action on permanent delete only but it is also running on soft delete too which must not be the case because of eloquent default nature of ignoring soft deleted items.\r\n\r\nWhat i suggest is to make 2 more new events for soft deleting and soft delete in framework or make the eloquent automatically detect the item is soft deleted and act deleting only on permanent delete until the user gives directions to act on soft delete too.\r\n\r\nNote: i know that doing a little trick with if condition in events class i can detect item is soft deleted or not but that must have been done by eloquent automatically because of its nature to soft deleted items.\r\n\r\n### Steps To Reproduce:\r\n1. Model: https://github.com/mubbi/laravel-blog-5.6.5/blob/master/app/Blog.php\r\n2. Controller: https://github.com/mubbi/laravel-blog-5.6.5/blob/master/app/Http/Controllers/Admin/BlogsController.php\r\n3; Events: https://github.com/mubbi/laravel-blog-5.6.5/tree/master/app/Events\r\n"}}
{"actor":{"display_login":"mubbi"}}