radioheart's avatar

Laravel Pagination Problem

i'm getting error when i add paginate how can i fix it?

array_key_exists(): The first argument should be either a string or an integer
$titles = Titles::join('users', 'entries.user_id', '=', 'users.id')
       ->where(function($query) use ($value,$uni_id) {
           $query->whereIn('entries.user_id', function($query) use ($value)
                {
                $query->select(DB::raw('CASE WHEN user_id='. $value .' THEN content_id ELSE user_id END AS friendID'))
                      ->from('tasks')
                      ->where('type', 2)
                      ->where('situation', 1)
                      ->where(function ($query) use ($value) { 
                            $query->where('user_id', $value)
                                  ->orWhere('content_id', $value);
                        });
                });
            $query->orWhere('user_id', $value);
            $query->orWhere('univercity_id', 1);
       })
       ->where('entries.title_id',0)
       ->orderBy('entries.id','DESC')
       ->paginate(5)
       ->get(['entries.*','users.name','users.username']);
0 likes
1 reply
radioheart's avatar

i figured out = ) i use "take" for paginate and fixed.

Please or to participate in this conversation.