title: How to get property on relation in blade
body: <p>I'm getting the following error in my view when trying to access a property in a hasOne relationship inside a view, Am I not allowed to do this from the view, basically what I want to achieve is to have a dynamic select on properties that i can relate to the listing model.</p>
  
  <pre><code>Undefined property: Illuminate\Database\Eloquent\Relations\HasOne::$name (View: C:\wamp64\www\grupoeverest\resources\views\admin\listing\property.blade.php)
  </code></pre>
  
  <p>PropertyType model</p>
  
  <pre><code>class PropertyType extends Model
  {
      protected $table = "property_types";
      protected $fillable= ['name'];
      public function property()
      {
          return $this-&gt;belongsTo('App\Property');
      }
  }
  </code></pre>
  
  <p>Property model</p>
  
  <pre><code>class Property extends Model
  {
      protected $table="properties";
      protected $fillable=['value'];
  
      public function propertyType(){
          return $this-&gt;hasOne('App\PropertyType');
     }
      public function listing(){
          return $this-&gt;belongsTo('App\Listing');
     }
   }
  </code></pre>
  
  <p>Listing model</p>
  
  <pre><code>class Listing extends Model
  {
  
      protected $table="listings";
      protected $fillable=['name','price','squaremeters','number',
          'street','neighbourhood','description','description',
          'zipcode','longitude','latitude', 
          'listing_type_id','operation_type_id' ];
      public function listingType(){
          return $this-&gt;hasOne('App\ListingType', 'id');
      }
      public function pictures(){
          return $this-&gt;hasMany('App\Picture', 'listing_id');
      }
      public function properties(){
          return $this-&gt;hasMany('App\Property', 'listing_id');
      }
  
   }
  </code></pre>
  
  <p>Controller action</p>
  
  <pre><code>    public function properties($id)
      {
  
          return view('admin.listing.property',[
              'listing' =&gt; Listing::find($id),
              'types' =&gt; ListingType::all(),
          ]);
      }
  </code></pre>
  
  <p>view</p>
  
  <pre><code>  &lt;div class="row"&gt;
    &lt;div class="col-md-6"&gt;
    &lt;h4&gt;here
    &lt;/h4&gt;
  
    @foreach($listing-&gt;properties as $property)
    &lt;h4&gt; {{$property-&gt;value}}{{$property-&gt;propertyType()-&gt;name}}
    &lt;/h4&gt;
  
    @endforeach
    &lt;/div&gt;
  </code></pre>