Define category relation for Post models (supposing you have 'Category' model)
public function category(){
return $this->belongsTo('Category');
}
Now from a post you can access to category:
$post = Post::find(1);
echo $post->category->type;
Take a look at this link: http://laravel.com/docs/eloquent#relationships
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community