title: Laravel conditional routing based on database value
body: <p>I'm developing an admin panel with laravel. I'm putting a preference for an end user to choose if the site is down (for maintenance or similar purpose). 
  The preference will be stored as boolean in the database. Based on this value frontend will be routed to a custom view if the site is down. </p>
  
  <p><strong>(Site will be hosted on a shared host, no SSL. Using artisan commands are not an option.)</strong></p>
  
  <p>Currently, I can get "site_is_down" value from the database at boot time with a custom method in AppServiceProvider.php's register() method.</p>
  
  <p>But I'm not sure how can I route calls based on this value in the routes file.
  I have two named route groups (Frontend and Backend) and standard Auth::routes() in routes/web.php. Only frontend routes should be conditionally routed. Backend and Auth should be excluded. (So the user can access Backend panel).</p>
  
  <p>I'm trying to achieve something like this:</p>
  
  <p>(I know this is not proper syntax, I'm trying to explain my mind)</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  if (config('global.site_is_down') === true) {
      //Route all frontend route group to maintenance view -&gt;except(Backend and auth)
  } else {
      //Route all as normal
  }
  </code></pre>