Ich bin eine Abfrage in meinem MySQL-Editor erstellen, aber jetzt möchte ich diese SQL unten in einem Abfrage-Generator SQL in Laravel 5, kann mir jemand helfen? Ich habe viel über Where IF Zustand in Laravel gesucht, aber wurde nicht gefunden.Wie kann ich abfragen Build Wo IF Bedingung in Laravel
select *
from eventos
where inicio = '2016-09-06 09:41'
and recorrencia = 0
or recorrencia = 1
and
(
if (recorrencia_tipo = 'semanal', recorrencia_intervalo, 7) LIKE concat('%', weekday('2016-09-06 00:00:00'), '%')
or
if(recorrencia_tipo = 'mensal', recorrencia_intervalo, 0) = day('2016-09-06 09:41')
or
(
if (recorrencia_tipo = 'anual', substring_index(recorrencia_intervalo, '/', 1), 0) = DAY('2016-09-06 09:41')
or
if (recorrencia_tipo = 'anual', substring_index(recorrencia_intervalo, '/', -1), 0) = MONTH('2016-09-06 09:41')
)
)
ich gebaut, bis diese in Laravel
Evento::where('inicio', '2016-09-06 09:41')
->where('recorrencia', 0)
->orWhere('recorrencia', 1)
->where('recorrencia_tipo', function ($query) {
})->get();
Warum versuchen Sie nicht einmal rohe Abfrage einmal? – vijaykumar
Danke Kumpel, deine Antwort hilft mir sehr viel = D –