vendredi 8 mars 2019

How to pass a function in laravel view?

I have the following a Course Model with a function of trainers and I'm trying to pass it to the view so I can see the trainers for the course.

Here is my model function

public function trainers()
{
    return $this->belongsToMany(User::class, 'course_user');
}

This is my view where I'm trying to pass the Model Course and the function trainers.

<h6 class="card-subtitle text-muted">Trainer: </h6>

And this is the error I'm getting:

htmlspecialchars() expects parameter 1 to be string, object given (View: /Applications/MAMP/htdocs/hs-03/resources/views/admin/courses/showCourse.blade.php)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire