vendredi 7 décembre 2018

Laravel Eager loading specific columns

I have two classes, Book and Category. The relationship is defined properly.

When i use like: Book::with('category')->where(...)->first()

It returns like:

Book{
bookid:
bookname:
.
.
Category{
    categoryid:
    categoryname:
    .
    .
    }
}

Is there a possible way, to return like the format below without using join?:

Book{
bookid:
bookname:
.
.
categoryid:
categoryname:
.
.
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Ps2WDv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire