Как в этом случае:
Код: Выделить всё
if($id_curso > 0)
$aulas = Aula
::select( 'fields' )
->where('id_curso', 3)
->where('condition_1');
else
$aulas = Aula
::select( 'fields' )
->where('condition_1');
return $aulas->get();
Код: Выделить всё
$aulas = Aula
::select( 'fields' );
if($id_curso > 0)
$aulas.= Aula::where('id_curso', 3);
$aulas.= Aula::where('condition_1');
return $aulas->get();
Код: Выделить всё
$aulas = Aula
::select('fields');
if($id_curso > 0)
$aulas->where('id_curso', $id_curso);
$aulas->where('condiotion_1');
return $aulas->get();
Подробнее здесь: https://stackoverflow.com/questions/399 ... by-php-ifs
Мобильная версия