Convert query
Hi, i need convert this query to SQL, I am very new developer.
$contents = Publish::select('id', 'time_to_air', 'date' ,'position')
->where('emission_id', $request->emission->id)->with(['files' => function($query) {
$query->select('url', 'md5');
}])->orderBy('position', 'ASC')
->get();
Thanks
@mutant3 You can use ->toSql().
$contents = Publish::select('id', 'time_to_air', 'date' ,'position')
->where('emission_id', $request->emission->id)->with(['files' => function($query) {
$query->select('url', 'md5');
}])->orderBy('position', 'ASC')
->get()
->toSql();
@tisuchi Oh sorry, I need this query convert to SQL plain.
@mutant3 Have you tried this?
You just do dd($contents) that will give you a plain SQL.
Ofcourse, you may need to adjust the request values.
Please or to participate in this conversation.