I got ErrorException Undefined variable: skip using the following code.
$skip = ($page -1 ) * 10;
//dd($skip); // here return int(0)
$thread = Thread::with([
'posts' => function ($query) {
$query->skip( $skip )->take(10);
}
, 'posts.users', 'posts.replys', 'posts.replys.users'])->find($thread->id);
Why undefined? It did return something using dd !
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community