WHERE Clause Inner Join [closed]

1

Well, I have a form that should be filtering the selected fields by searching the information directly in the database, however I do not know how to use the where clause, can anyone here help me or give me some tips? Thank you in advance.

Note: I can return all the fields saved in the database, however I want to return only those that are selected in the form, which I do not want to be blank, I have the following:

$table = DB::table('projecao_despesa as ppadesp')
           ->join('unidade as unid', 'ppadesp.unidadeId', '=', 'unid.id')
           ->join('orgao', 'unid.orgaoId', '=', 'orgao.id')
           ->join('poder', 'orgao.poderId', '=', 'poder.id')
           ->join('funcao as func', 'ppadesp.funcaoId', '=', 'func.id')
           ->join('sub_funcao as subfunc', 'ppadesp.subfuncaoId', '=', 'subfunc.id')
           ->join('programa as prog', 'ppadesp.programaId', '=', 'prog.id')
           ->join('acao', 'ppadesp.acaoId', '=', 'acao.id')
           ->join('elemento as elem', 'ppadesp.elementoId', '=', 'elem.id')
           ->join('ppa', 'ppadesp.ppaId', '=', 'ppa.id')
           ->select('poder.nome as a', 'orgao.nome as b', 'unid.nome as c', 
                   DB::raw("concat(func.funcao, '.', subfunc.subFuncao, '.', prog.programa, '.', acao.acao, '.', elem.elemento) as d"), 
                   'ppa.anoInicio as e', 'ppadesp.valorAno1 as f', 'ppadesp.valorAno2 as g', 
                   'ppadesp.valorAno3 as h', 'ppadesp.valorAno4 as i')
           ->orderby('ppadesp.id')->paginate(5);


$header = ['Poder', 'Orgão', 'Unidade', 'Funcional', 
        'Ano Inicial', 'Primeiro Ano', 'Segundo Ano', 'Terceiro Ano', 'Quarto Ano'];

   return View('results.planejamento.ppa_despesa', ['header' => $header, 'table' => $table]);
    
asked by anonymous 14.03.2016 / 18:18

0 answers