Laravel: issue with relation -


i have had issue project on laravel 5.2. have 2 tables: journal , journaldetails onetoone relation. model journaldetails has constructor parameters. so, had next code in journal model:

public function journaldetail() {     return $this->hasone('journaldetail', 'journal_id'); } 

i want journaldetail:

@if (isset($j->journaldetail))     <td>$j->journaldetail->name</td> @else     <td></td> @endif 

but error during one: missing argument 1 app\models\journaldetail::__construct(), called in c:**\vendor\laravel\framework\src\illuminate\database\eloquent\model.php on line 740 , defined (view: c:**\resources\views\pages\admin\get_journal.blade.php)

for testing deleted parameters in journaldetail , there no errors. laravel bug? why constructor called?

try $j->journaldetail[0]->name


Comments