Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How can we add where clause on table joins or simple tables in any datagrid in Bagisto?

    Knowledge Base
    1
    1
    2044
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sanjana singh last edited by

      For Simple Table -

      $queryBuilder = DB::table('table_name')
      ->select('column_name')
      ->addSelect('column_name1', 'column_name2', ...)
      ->where('condition', condition_value);

      For Table Joins -
      $queryBuilder = DB::table('table_name1')
      ->leftJoin('table_name2', function($leftJoin) {
      $leftJoin->on('table_name2.table_name2_column', '=', 'table_name1.table_name1_column')
      ->where('table_name2.table_name2_column_for_condtion', 'condition_value');
      })
      You can change type of join according to your need. You can also see datagrid code for it, we have applied joins for some datagrids.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post