Ejemplos de consultas con Eloquent

Ayuda rápida de consultas con Eloquent

 

whereRaw

Model::whereRaw('publish_end_date > NOW()')->get()

where multiple

Model::where(['type'=>$type,'filename'=>$filename])->first() 

Model::where('type,$type)->where('filename',$filename])->first()

where dentro de una relación

$medias = Media::whereHas('tags', function ($q) use ($tags) {
$q->whereRaw('UPPER(name) in ("' . $tags . '")');
})->Playlist(env('CLARO_BR_SYNC_PLAYLIST'))->get();

where between

$query->whereBetween('created_at', arrDateToDB(explode('-', $dates)));