title: Calling a model function from a controller in Laravel 5.2
body: <p>I have a model config which has the following at the top:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use DB;
  use Illuminate\Database\Eloquent\Model;
  
  class Config extends Model
  {
      protected $table = 'config';
  
      public function getConfigVariables()
      {
          $config = DB::table('config')-&gt;where('is', '1')-&gt;first();
          session()-&gt;put('name',$config['name']);
          session()-&gt;put('infoemail',$config['infoemail']);
          session()-&gt;put('copyrightowner',$config['copyrightowner']);
  </code></pre>
  
  <p>and I wish to call this in a controller to set up the session so in the route for the top level I set set up </p>
  
  <pre><code>Route::get('/',
  [
      'uses' =&gt; 'ConfigController@ConfigVariables',
      'as' =&gt; 'home'
  ]);
  </code></pre>
  
  <p>The config controller method which does not work is:</p>
  
  <pre><code> public function ConfigVariables()
      {
  
              Config::getConfigVariables();
              session()-&gt;put('thisyear',ReturnCurrentYear());
              $footer = "&amp;copy ".session()-&gt;get('thisyear').", ".session()-&gt;get('name');
              session()-&gt;put('footer',$footer);
  
          return view('welcome');
      }
  </code></pre>
  
  <p>but this does not work and I am stuck!</p>