title: Laravel: Get access to class-variable from public static function (basic oop issues)
body: <p><strong>EDIT</strong></p>
  
  <p>In the meantime this question is been visited a few times. Just to share what I´ve learned with the help of stackoverflow and other resources I´d not recommend using the technique I was asking for. A cleaner way is to attach a variable containing the database-text within the controller:</p>
  
  <pre><code>$txt = Model::find(1);
  return view('name', array('text' =&gt; $txt-&gt;content);
  </code></pre>
  
  <p>Now you can access text in your view like so</p>
  
  <pre><code>{{ $text ?? 'Default' }}
  </code></pre>
  
  <p>But if you´re currently also hustling with basic oop and/or mvc architecture read on. Maybe it helps :-)</p>
  
  <hr>
  
  <p><strong>ORIGINAL QUESTION</strong></p>
  
  <p>I´m trying to output some text loaded from db.
  This is my setup:</p>
  
  <p>View:</p>
  
  <pre><code>{{ ContentController::getContent('starttext') }}
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>class ContentController extends BaseController {
  
      public $text = '';
  
      public static function getContent($description)
      {
          $content = Content::where('description', $description)-&gt;get();
          $this-&gt;text = $content[0]-&gt;text;
  
          return $this-&gt;text;
      }
  
  }
  </code></pre>
  
  <p>I was trying various ways to declare a class variable and access it in my function but I always end up with:</p>
  
  <h3>Using $this when not in object context</h3>
  
  <p>tbh I think I lack some basic oop knowledge :-D</p>