How to create subdomain in Laravel dynamically?
<p>In my Windows/System32/drivers/etc/<strong>hosts</strong>, I have this:</p>

<pre><code>127.0.0.1   localhost
127.0.0.1   site.dev
127.0.0.1   *.site.dev
</code></pre>

<p>In my xampp/apache/conf/extra/<strong>httpd-vhost</strong>, I have this:</p>

<pre><code>&lt;VirtualHost site.dev&gt;  
  DocumentRoot "C:/xampp_7/htdocs/"
  &lt;Directory "C:/xampp_7/htdocs/"&gt;
  &lt;/Directory&gt;
&lt;/VirtualHost&gt;
&lt;VirtualHost *.site.dev&gt;  
  DocumentRoot "C:/xampp_7/htdocs/"
  &lt;Directory "C:/xampp_7/htdocs/"&gt;
  &lt;/Directory&gt;
&lt;/VirtualHost&gt;
</code></pre>

<p>Now if I am going to run <a href="http://site.dev/project/public" rel="noreferrer">http://site.dev/project/public</a>, It is working. I have this route command:</p>

<pre><code>Route::group(['domain' =&gt; '{subdomain}.site.dev'], function($subdomain) {
    return $subdomain;
});
</code></pre>

<p>If I open <a href="http://sub.site.dev/startscript/public/" rel="noreferrer">http://sub.site.dev/startscript/public/</a> , I get an error of "This site can’t be reached".</p>

<p>The function of the program is that it can create subdirectories. Example, I have a business website. I can access/create like this.</p>

<pre><code>inventory.mybusiness.com
sales.mybusiness.com
ad.mybusiness.com
</code></pre>