This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

thomas15915526
thomas15915526

just one more quick question - how can I display this on the front end.

I've created my albums/:slug page and then created {{record.album_id }} but this doesn't display anything.

I know in blade you would need to call the method but not sure how this is done in twig

DMeganoski
DMeganoski

Glad you got it working. I told you to remove the relation from the model for the form, but I forgot to mention that you will need to define the relation in columns.yaml of the model for it to show in the index table.

Sorry, I haven't started working on the frontend yet. :/ Couldn't tell you. but if you can access the model, perhaps try using a standard eloquent relation and calling that. I.E.



public function album() {
    return $this->belongsTo('Company/Plugin/Album');
}

and then just


$record->album;

Last updated

janedoe
janedoe

you have to go to model class file for example in my project it is movie.php there you have to define relation in this way:

<?php namespace Shajid\Movies\Models;

use Model;

/**

  • Model */ class Movie extends Model { use \October\Rain\Database\Traits\Validation;

    /*

    • Validation */ public $rules = [ ];

    /*

    • Disable timestamps by default.
    • Remove this line if timestamps are defined in the database table. */ public $timestamps = false;

    /**

    • @var string The database table used by the model. */ public $table = 'shajidmovies';

    / Relation /

    public $belongsToMany = [

    'genres' => [

    'Shajid\Movies\Models\Genre',

    'table' => 'shajid_movies_movies_genres',

    'order' => 'genre_title'

    ]

    ];

    public $attachOne = [

    'poster' => 'System\Models\File'

    ];

    public $attachMany = [

    'movie_gallery' => 'System\Models\File'

    ];

} may be your problem get solved.

21-23 of 23

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.