Laravel shared cookie detection issue in domain and subdomain : <p>I am working on Laravel 5.4.30.</p>

<p>Imagine that we have a domain <code>example.com</code> and a subdomain of <code>dev.example.com</code>. The main domain is for master branch and the dev subdomain is for develop branch. We have cookie notice system that will be hidden after clicking on <code>Hide Cookie Notice</code> button. This works by setting a cookie forever.
We have set the <code>SESSION_DOMAIN</code> configs to each domain for each environment.</p>

<p>For main domain:</p>

<pre><code>SESSION_DOMAIN=example.com
</code></pre>

<p>For dev subdomain:</p>

<pre><code>SESSION_DOMAIN=dev.example.com
</code></pre>

<p>Now the issue comes from here. If we go to the <code>example.com</code> and click on hiding the cookie notice, a cookie will be set forever for main domain. After that we go to the <code>dev.example.com</code> and do the same. So a cookie will be set for subdomain as well. But this cookie has been set after previous one. (The order is important)
Now if we refresh the subdomain, we will see that notice again! (not hidden) The browser has read the main cookie because of <code>.example.com</code> set in <code>domain</code> parameter of cookie in the browser, so every subdomain will be affected. But the view still shows the notice because it cannot read any cookie for hiding.</p>

<p>Anyway I don't want to share that cookie across all subdomains. How can I achieve that? I think I should add a prefix for cookie name. But I don't know how to do it, that laravel automatically adds prefix to cookie name.</p>

<p>Any solutions?</p>
