/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Request $request) { $creditos = Lancamento::credito()->with('boleto', 'cheque')->orderBy('id', 'desc'); if ($request->q != '') { $creditos = $creditos->where('descricao', 'LIKE', '%' . $request->q . '%')->orWhere('valor', 'LIKE', '%' . $request->q . '%')->where('tipo_lancamento', 'C'); } $creditos = $creditos->paginate(); return view('creditos.index', compact('creditos')); }