jeudi 4 octobre 2018

Relational functions not working in laravel

Order by is working for this one...

$posts   = PostClass::where('thread_id',1)->orderBy('id','desc')->paginate(20);

but order by is not working for this one.

$thread = ThreadClass::find(1);
$posts   = $thread->posts()->orderBy('id','desc')->paginate(20);

Laravel Version : 5.5



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire