It looks like you're new here. If you want to get involved, click one of these buttons!
I tried making many edits to the above function in order to get the name column from the foreign key associated table. I tired referring to the documentation http://docs.getfuelcms.com/general/models#highlighter_805078 and made necessary edits by changing the find parameter to 'key', but nothing worked.
$award_list = fuel_model('awards', array('find' => 'all', 'where' => "type='Awards'", 'order' => 'visible_order desc', 'limit' => 2));
Also I would like to display name of the press_release_id associated in the admin panel as well of the awards admin listing.
class Awards_model extends Base_module_model{
public $required = array('title', 'type');
public $unique_fields = array('slug');
public $foreign_keys = array('press_release_id' => array(FUEL_FOLDER => 'pressreleases_model'));
public function __construct(){
parent::__construct('awards');
}
function list_items($limit = NULL, $offset = 0, $col = 'id', $order = 'asc', $just_count = false)
{
$this->db->select('id, title, type ,business_category, press_release_id, visible, visible_order', FALSE);
$data = parent::list_items($limit, $offset, $col, $order, $just_count);
return $data;
}
function form_fields($values = array(), $related = array()){
$fields = parent::form_fields($values);
$fields['slug'] = array('type' => 'slug', 'linked_to' => 'title');
return $fields;
}
}
Comments
No, I don't have an Award_items_model specified, the above shared code is the only model code I am using.
http://docs.getfuelcms.com/modules/simple