$postbacks = DB::table('postbacks as p')
->select(
DB::raw('DATE(p.created_at) as date'),
'u.name as user_name',
'c.name as campaign_name',
'c.domain',
'pr.name as provider_name',
'pr.commission',
DB::raw('SUM(p.income) AS t_income'),
DB::raw('SUM(p.cost) AS t_cost')
)
->join('campaigns as c', 'p.campaign_id', '=', 'c.id')
->join('providers as pr', 'c.provider_id', '=', 'pr.id')
->join('users as u', 'c.user_id', '=', 'u.id')
->whereBetween('p.created_at', ['2023-08-15', '2023-08-17'])
->where('c.user_id', 1)
->groupBy(DB::raw('DATE(p.created_at)'), 'c.id')
->orderBy('date', 'ASC')
->get();
public class BrandHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
public String id;
public CardView cardBrand;
public TextView txtTitle;
public BrandHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
//String itView = String.valueOf(itemView);
cardBrand = (CardView) itemView.findViewById(R.id.cardBrand);
txtTitle = (TextView) itemView.findViewById(R.id.txtTitle);
}
@Override
public void onClick(View v) {
Log.d("ITEM", String.valueOf(this.id));
Snackbar.make(cardBrand, "onClick at position : " + getLayoutPosition(), Snackbar.LENGTH_LONG).show();
}
}