Hi all,
I am using Ardent as a standalone package, together with Laravels Database package.
Things are set up, and I can query just fine - But when I define my relations, I get a white screen when I try to dump the expected data.
I have double checked and the data + relations are set up just as they should in the DB.
This is my two test models:
PAGES MODEL:
<?php namespace App\models;
use LaravelBook\Ardent\Ardent as Ardent;
class page extends Ardent
{
# Table name for model
protected $table = 'generator_pages';
# Relationships
public static $relationsData = array( 'menu' => array( self::HAS_ONE, '\App\models\menu', 'foreignKey' => 'ID' ) );
}
MENUS MODEL:
<?php namespace App\models;
use LaravelBook\Ardent\Ardent as Ardent;
class menu extends Ardent
{
# Table name for model
protected $table = 'generator_menus';
# Relationships
public static $relationsData = array('pages' => array(self::HAS_MANY, '\App\models\page', 'foreignKey' => 'menu_id'));
}
No errors are thrown. If I try extending the models with eloquent I still dont get any related data returned.
This should get me the pages for a specific menu id, but I get no data returned:
$pages_for_menu = menu::find( 1 )->pages;
foreach ( $pages_for_menu as $page ) {
echo $page->page_name . '<br />';
}
What am I missing here?
Regards, Klemme