lundi 4 septembre 2017

how to print project_name using project_id in Laravel 5.2

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





actually now I need print project name here also, how can do this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire