@ekhlas is limit and order by inline query ?
Self join query in laravel 5.6
Hello I have a query : SELECT e.id,e.name_other, e.name, m.name AS manager,e.start_date,e.end_date,e.status FROM tm_vendor e, tm_vendor m WHERE e.gid=m.id AND e.status=1
I want to convert into Laravel. I have to write code.
public function children() { return $this->hasOne(static::class, 'gid'); }
$vendorQuery = DB::connection($this->connection)->table($this->table)->select( 'id', 'name_other', 'name', 'name' , 'start_date', 'end_date', 'status')->with('children');
$vendorQuery->where('status', $status); $vendorArr = $vendorQuery->offset($start) ->limit($limit) ->orderBy($sidx, $sord) ->get() ->toArray();
but facing some issue. please help me
Please or to participate in this conversation.