samedi 9 février 2019

Ask How to display data from pivot tables in blade Laravel

I am confused. I want to display all loan data with a username to the table in the blade. This is my confusion :

This table I want to display in blade :

This Table I want to display

This is the table that i use :

This is the table that i use

This My Model User :

public function book(){
    return $this->belongsToMany(Book::class, 'loans')->withPivot(['loan_date','status'])->withTimeStamps();
}

This My Book Model :

 public function user(){
    return $this->belongsToMany(User::class, 'loans')->withPivot(['loan_date','status'])->withTimeStamps();
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire