title: Automatic Laravel routing for static pages
body: <p>I have to maintain a site for a client, they had it made with Laravel, the most frequent requests from them are to create new static pages and the more I create them - the more I feel there are definitely better ways to implement them.<br><br>
  To create a static page I go to the admin panel, a menu &quot;Static Pages&quot;, push a button &quot;Create New&quot; and there create an entry that goes into a database table. To make the static page show in the website I have to define it in a controller called &quot;FrontEndController&quot; like this:</p>
  <pre><code>public function some_page() {
    $page = StaticPages::find(1);
    return view('frontend.static_pages.some_page', compact('page'));
  }
  
  public function some_other_page() {
    $page = StaticPages::find(2);
    return view('frontend.static_pages.some_other_page', compact('page'));
  }
  
  ...
  </code></pre>
  <p>Then define routes like this:</p>
  <pre><code>Route::get('some-page', 'FrontEndController@some_page')-&gt;name('static_page.some_page');
  
  Route::get('some-other-page', 'FrontEndController@some_other_page')-&gt;name('static_page.some_other_page');
  </code></pre>
  <p>Now I always thought that you create an admin panel with a menu &quot;Static Pages&quot; and a button &quot;Create New&quot; so that you don't have to put any code manually, but seemingly the developer had other ideas...<br><br>
  So my question is how do you refactor a code like this so that you don't have to go through all of the repetitive process in any similar scenario and write code manually?<br><br>
  Btw I may need to sometimes send some generic params to different static pages and I want to keep the URLs the same as they are. Please, keep in mind that I'm not a very advanced user of Laravel or even PHP.</p>