I keep getting trying to get property of non-object anything am using laravel Eloquent Relationships. i Know that the eloquent relationship code is correct but i keep getting error.
This is my Video Controller
class Video extends Model
{
protected $fillable = [
'vid',
'v_img',
'v_bg_img',
'v_title',
'v_description',
'category_id',
'previous_view',
'previous_like',
'today_view',
'today_like',
'daily_view',
'daily_like',
'weekly_view',
'weekly_like',
'promoted',
'linked',
'vid_entry_date'
];
public function videoRank()
{
return $this->belongsTo('\App\VideoRank', 'category_id');
}
}
This is my Video Rank Controller
class VideoRank extends Model
{
protected $fillable = [
'rankName',
'minRank',
'maxRank'
];
public function video(){
return $this->hasMany('\App\Video','category_id');
}
}
This is my blade view
@foreach($videos as $video)
<tr class="odd gradeX">
<td></td>
</tr>
@endforeach
I keep getting error 'Trying to get property of non-object '
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire