mardi 6 novembre 2018

How can i get value from 3 table Joined with FK in Blade view

table : projects enter image description here

table : projects_departmentsenter image description here table : departmentsenter image description here

This is Model Project

public function projects_departments() {
    return $this->hasMany(Project_department::class); 
}

This is Model Project_department

public function projects()
{
    return $this->belongsTo(Project::class);
}

public function departments()
{
    return $this->belongsTo(Department::class);
}

This is Model Department

public function projects()
{
    return $this->hasMany(Project::class);
}

public function projects_departments() {
    return $this->hasMany(Project_department::class); 
}

this is my blade

project->departments->department_name

This is MY error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'projects_departments.project_id' in 'where clause' (SQL: select * from projects_departments where projects_departments.project_id = 48 and projects_departments.project_id is not null)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire