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

i changed my codes to

$titles = Titles::join('users', 'entries.user_id', '=', 'users.id')
       ->where('title_id', '0')
       ->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);
                    });
            })
       ->get(['entries.*','users.name']);

       return View::make('test_home', compact('titles'));

and now i'm stucked,

0

Sign in to participate in this thread!

Eventy

Your banner here too?

radioheart radioheart Joined 23 Dec 2014

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.