dimanche 20 août 2017

Property [species_code] does not exist on this collection instance

I have A problem with this eloquent, i trying to combine this 3 table to display the data in one table on view pages. But it turns to the error . please help me. did i do any error on the coding or table relation? Models

TreeCategory Models

namespace App;

use Illuminate\Database\Eloquent\Model; use App\TreeScientific;

class TreeCategory extends Model {

protected $fillable = [

    'id',
    'code',
    'category',

];

public function scientific()
{
    return $this->hasMany('App\TreeScientific','tree_category_id');
}

}

TreeScientific

namespace App;

use Illuminate\Database\Eloquent\Model; use App\TreeCommon;

class TreeScientific extends Model {

protected $fillable = [

    'tree_category_id',
    'species_code',
    'scientific_name',

];

public function common()
{
    return $this->hasOne('App\TreeCommon','scientific_id');
}

}

TreeCommons

namespace App;

use Illuminate\Database\Eloquent\Model;

class TreeCommon extends Model {

protected $fillable = [

    'scientific_id',
    'common_name',

];

}

Blade.php

 <tbody>
      @foreach ($category as $kategori)
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>

      @endforeach



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uXwmUn
via IFTTT

Aucun commentaire:

Enregistrer un commentaire