title: Undefined Property on Controller from file array
body: <p>I'm new to php and to stack so I beg you some patience with me.
  I'm learning with Laravel framework at university and the next code gives me this message:</p>
  
  <blockquote>
    <p>Undefined property:
    App\Http\Controllers\CatalogController::$arrayPeliculas</p>
  </blockquote>
  
  <p>I will show you the code now:</p>
  
  <p><strong>-CatalogController.php</strong></p>
  
  <pre><code>    &lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  class CatalogController extends Controller{
  
      public function getIndex(){
           return view('catalog.index',
            array('arrayPeliculas'=&gt;$this-&gt;arrayPeliculas));
      }
  
      public function getShow($id){
  
          return view('catalog.show', array('id'=&gt;$id));
      }
  
      public function getCreate(){
  
          return view('catalog.create');
      }
  
      public function getEdit($id){
  
          return view('catalog.edit', array('id'=&gt;$id));
      }
  }
  </code></pre>
  
  <p><strong>-index.blade.php</strong></p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --&gt;
    &lt;title&gt;Bootstrap 101 Template&lt;/title&gt;
  
    &lt;!-- Bootstrap --&gt;
    &lt;link href="css/bootstrap.min.css" rel="stylesheet"&gt;
  
    &lt;!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --&gt;
    &lt;!-- WARNING: Respond.js doesn't work if you view the page via file:// --&gt;
      &lt;!--[if lt IE 9]&gt;
        &lt;script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"&gt;&lt;/script&gt;
        &lt;script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"&gt;&lt;/script&gt;
        &lt;![endif]--&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;div class="container"&gt;
          @extends('layouts.master')
  
          @section('content')
  
          &lt;div class="row"&gt;
  
            @foreach( $arrayPeliculas as $key =&gt; $pelicula )
            &lt;div class="col-xs-6 col-sm-4 col-md-3 text-center"&gt;
  
              &lt;a href="{{ url('/catalog/show/' . $key ) }}"&gt;
                &lt;img src="{{$pelicula['poster']}}" style="height:200px"/&gt;
                &lt;h4 style="min-height:45px;margin:5px 0 10px 0"&gt;
                  {{$pelicula['title']}}
                &lt;/h4&gt;
              &lt;/a&gt;
  
            &lt;/div&gt;
            @endforeach
  
          &lt;/div&gt;
  
          @stop
        &lt;/div&gt;
        &lt;!-- jQuery (necessary for Bootstrap's JavaScript plugins) --&gt;
        &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"&gt;&lt;/script&gt;
        &lt;!-- Include all compiled plugins (below), or include individual files as needed --&gt;
        &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p><strong>-array_peliculas.php</strong></p>
  
  <pre><code>private $arrayPeliculas = array(
      array(
          'title' =&gt; 'El padrino',
          'year' =&gt; '1972', 
          'director' =&gt; 'Francis Ford Coppola', 
          'poster' =&gt; 'http://ia.media-imdb.com/images/M/MV5BMjEyMjcyNDI4MF5BMl5BanBnXkFtZTcwMDA5Mzg3OA@@._V1_SX214_AL_.jpg', 
          'rented' =&gt; false, 
          'synopsis' =&gt; 'Don Vito Corleone (Marlon Brando) es el respetado y temido jefe de una de las cinco familias de la mafia de Nueva York. Tiene cuatro hijos: Connie (Talia Shire), el impulsivo Sonny (James Caan), el pusilánime Freddie (John Cazale) y Michael (Al Pacino), que no quiere saber nada de los negocios de su padre. Cuando Corleone, en contra de los consejos de \'Il consigliere\' Tom Hagen (Robert Duvall), se niega a intervenir en el negocio de las drogas, el jefe de otra banda ordena su asesinato. Empieza entonces una violenta y cruenta guerra entre las familias mafiosas.'
      )
  </code></pre>
  
  <p>This array is more large but for an example its ok. Can anybody help me?
  Just for info, the route.php file works fine.</p>