Reputation: 163
in My laravel app I have tasks table as below,
id task_name project_id
1 aaa 1
2 hjhkj 2
3 jhghg 1
project table as below,
id name
1 abc
2 xyz
task model relationship with project model is
public function project()
{
return $this->belongsTo('App\Project');
}
I am printing some data using task table in show.blade.php
{{$tasks->project_id}}
{{$tasks->task_name}}
actually now I need print project name here also, how can do this?
Upvotes: 0
Views: 51