Support the ongoing development of Laravel.io →
Database Views Forms
Last updated 2 years ago.
0

your raw query returns an array of objects. a quick ugly way would be to use $books[0]->title;

better use eloquent's

$book = Book::where('slug', $slug)->first();
Last updated 8 years ago.
0

zam3858 said:

your raw query returns an array of objects. a quick ugly way would be to use $books[0]->title;

better use eloquent's

$book = Book::where('slug', $slug)->first();

Yap! The problem is solved, thanks!

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

antoniosai antoniosai Joined 14 Jun 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.