{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/laravel-responsecache/issues/7","labels_url":"https://api.github.com/repos/spatie/laravel-responsecache/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-responsecache/issues/7/comments","events_url":"https://api.github.com/repos/spatie/laravel-responsecache/issues/7/events","html_url":"https://github.com/spatie/laravel-responsecache/issues/7","id":104622931,"number":7,"title":"Add a variable to the output if cached","user":{"login":"Zyles","id":1741593,"avatar_url":"https://avatars.githubusercontent.com/u/1741593?v=3","gravatar_id":"","url":"https://api.github.com/users/Zyles","html_url":"https://github.com/Zyles","followers_url":"https://api.github.com/users/Zyles/followers","following_url":"https://api.github.com/users/Zyles/following{/other_user}","gists_url":"https://api.github.com/users/Zyles/gists{/gist_id}","starred_url":"https://api.github.com/users/Zyles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zyles/subscriptions","organizations_url":"https://api.github.com/users/Zyles/orgs","repos_url":"https://api.github.com/users/Zyles/repos","events_url":"https://api.github.com/users/Zyles/events{/privacy}","received_events_url":"https://api.github.com/users/Zyles/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-03T05:14:33Z","updated_at":"2015-09-03T07:17:03Z","closed_at":null,"body":"I want to add a variable in the JSON response \"fromCache: true\" to indicate if the response came from the cache. I don't want to only use the header.\r\n\r\nIs there an easy way to do this?\r\n\r\nWrite to it before it is saved somehow?"},"comment":{"url":"https://api.github.com/repos/spatie/laravel-responsecache/issues/comments/137357774","html_url":"https://github.com/spatie/laravel-responsecache/issues/7#issuecomment-137357774","issue_url":"https://api.github.com/repos/spatie/laravel-responsecache/issues/7","id":137357774,"user":{"login":"sebastiandedeyne","id":1561079,"avatar_url":"https://avatars.githubusercontent.com/u/1561079?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastiandedeyne","html_url":"https://github.com/sebastiandedeyne","followers_url":"https://api.github.com/users/sebastiandedeyne/followers","following_url":"https://api.github.com/users/sebastiandedeyne/following{/other_user}","gists_url":"https://api.github.com/users/sebastiandedeyne/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastiandedeyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastiandedeyne/subscriptions","organizations_url":"https://api.github.com/users/sebastiandedeyne/orgs","repos_url":"https://api.github.com/users/sebastiandedeyne/repos","events_url":"https://api.github.com/users/sebastiandedeyne/events{/privacy}","received_events_url":"https://api.github.com/users/sebastiandedeyne/received_events","type":"User","site_admin":false},"created_at":"2015-09-03T07:17:03Z","updated_at":"2015-09-03T07:17:03Z","body":"Hmm I don't think this is currently possible. The responsecache skips as much as the app as possible, and only goes through middleware. If you'd implement it there you'd have to unserialize the json, add the property and reserialize it, which sounds kind of counterproductive.\r\n\r\nIf it's a json response you could opt to not use this package use Laravel's default cache for the php object, and have more control over it. Since you're not rendering views and your data is all one one place I don't think it would be a huge difference in performance with this package. (Since I don't know your use case this could be completely irrelevant, just throwing some thoughts out)"}}