{"action":"opened","issue":{"url":"https://api.github.com/repos/laravel/internals/issues/733","repository_url":"https://api.github.com/repos/laravel/internals","labels_url":"https://api.github.com/repos/laravel/internals/issues/733/labels{/name}","comments_url":"https://api.github.com/repos/laravel/internals/issues/733/comments","events_url":"https://api.github.com/repos/laravel/internals/issues/733/events","html_url":"https://github.com/laravel/internals/issues/733","id":249773645,"number":733,"title":"DB pre-transaction hook","user":{"login":"OzairP","id":6686039,"avatar_url":"https://avatars3.githubusercontent.com/u/6686039?v=4","gravatar_id":"","url":"https://api.github.com/users/OzairP","html_url":"https://github.com/OzairP","followers_url":"https://api.github.com/users/OzairP/followers","following_url":"https://api.github.com/users/OzairP/following{/other_user}","gists_url":"https://api.github.com/users/OzairP/gists{/gist_id}","starred_url":"https://api.github.com/users/OzairP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OzairP/subscriptions","organizations_url":"https://api.github.com/users/OzairP/orgs","repos_url":"https://api.github.com/users/OzairP/repos","events_url":"https://api.github.com/users/OzairP/events{/privacy}","received_events_url":"https://api.github.com/users/OzairP/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-12T00:01:33Z","updated_at":"2017-08-12T00:01:33Z","closed_at":null,"body":"- Laravel Version: 5.4.x\r\n\r\n### Description:\r\nThis is more for discussion; but what are thoughts on having a database hook that is called before the query is called. This could be useful for caching database calls that are called from third party libraries or global caching queries.\r\n\r\nNot sure how this could be incorporated or designed within the system but this is an example I was thinking of.\r\n\r\n```PHP\r\nfunction(Builder $builder) {\r\n    if(Cache::has($builder->getQuery()->toSql()) {\r\n        return Cache::get($builder->getQuery()->toSql());\r\n    }\r\n}\r\n```\r\n\r\nIf the function returns null, continue with the transaction."}}
{"actor":{"display_login":"OzairP"}}