Closed catfishseo closed 9 years ago
I am trying to filter by the relationship and It return 0 records. What I am doing wrong? Everything else works fine (it displays all of the records with the right property name and filter drop-down box is generated correctly) Thank you,
This is the PropertyList model
<?php class PropertyList extends Eloquent { protected $table = 'property_list'; protected $guarded = [ "id", "created_at", "updated_at" ]; }
This is the PropertyImage model
<?php class PropertyImage extends Eloquent { protected $table = 'property_image'; protected $guarded = [ "id", "created_at", "updated_at" ]; public function property() { return $this->belongsTo('PropertyList','property_list_key','key'); } }
My propertyimages model conf
return array( 'title' => 'Apartment Images', 'single' => 'apartment', 'model' => 'PropertyImage', 'columns' => array( 'property' => array( 'title' => 'Property', 'relationship' => 'property', 'select' => '(:table).name', ), ), 'edit_fields' => array( 'property' => array( 'title' => 'Property', 'type' => 'relationship', 'name_field' => 'name', ), ), 'filters' => array( 'property' => array( 'title' => 'Property', 'type' => 'relationship', 'name_field' => 'name', ), ), );
return $this->belongsTo('PropertyList');
and make sure PropertyList has a name column.
I am trying to filter by the relationship and It return 0 records. What I am doing wrong? Everything else works fine (it displays all of the records with the right property name and filter drop-down box is generated correctly) Thank you,
This is the PropertyList model
This is the PropertyImage model
My propertyimages model conf