jeudi 25 juin 2020

laravel 7 i cant access comment and user in pivote table of user_id and course id

i cant access in user dashboard to comment and user comment... i use this relations

public function review_teachers()
{return $this->belongsToMany(Course::class,'review_teaches','user_id','course_id')->withTimestamps();}

and review_teaches colomon has two row that name is course_id and user_id.

i defined in controller for get data

 $list_review = auth()->user()->review_teachers()->get();

i can access to course .for example if defined i can acceess to course title and it is ok

1 question: i want to call user->name but not work and review->comment but not work



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire