Fetch and Passing filter data in List view in backpack-demo laravel












0














  public function setup() {

/*
|--------------------------------------------------------------------------
| BASIC CRUD INFORMATION
|--------------------------------------------------------------------------
*/
$this->crud->setModel('AppModelsResult');
$this->crud->setRoute(config('backpack.base.route_prefix') . '/result');
$this->crud->setEntityNameStrings('result', 'results');
$value = '';
/*
|--------------------------------------------------------------------------
| BASIC CRUD INFORMATION
|--------------------------------------------------------------------------
*/


$this->crud->addFilter([// add a "simple" filter called Draft
'type' => 'dropdown',
'name' => 'state',
'label' => 'State'
], [
'Delhi' => 'Delhi',
'Uttar Pradesh' => 'Uttar Pradesh',
'Tamil Nadu' => 'Tamil Nadu',
'Uttrakhand' => 'Uttrakhand',
],


$this->crud->addClause('where', 'state', 'LIKE', "%$value%");



});
$this->crud->addFilter([
'type' => 'dropdown',
'name' => 'parliamentary',
'label' => 'Parliamentary'
], [
'delhi' => 'Delhi',
'Uttar Pradesh' => 'Uttar Pradesh',
'Tamil Nadu' => 'Tamil Nadu',
'Uttrakhand' => 'Uttrakhand',
],
function($value) { )
$this->crud->addClause('where', 'parliamentary', 'LIKE', "%$value%");

});
$this->crud->addFilter([// add a "simple" filter called Draft
'type' => 'dropdown',
'name' => 'assembly_name',
'label' => 'Assembly Name'
], [
'Narela' => 'Narela', 'Burari' => 'Burari', 'Timarpur' => 'Timarpur',
'Adarsh Nagar' => 'Adarsh Nagar', 'Badli' => 'Badli', 'Rithala' => 'Rithala',
'Bawana' => 'Bawana', 'Mundka', 'Kirari' => 'Kirari', 'Sultan Pur Majra' => 'Sultan Pur Majra',
'Nangloi' => 'Nangloi', 'Jat Mangol Puri' => 'Jat Mangol Puri', 'Rohini' => 'Rohini',
'Shalimar Bagh' => 'Shalimar Bagh', 'Shakur Basti' => 'Shakur Basti',
'Tri Nagar' => 'Tri Nagar', 'Wazirpur' => 'Wazirpur', 'Model Town' => 'Model Town',
'Sadar Bazar' => 'Sadar Bazar', 'Chandni Chowk' => 'Chandni Chowk',
'Matia Mahal' => 'Matia Mahal', 'Ballimaran' => 'Ballimaran',
'Karol Bagh' => 'Karol Bagh', 'Patel Nagar' => 'Patel Nagar',
'Moti Nagar' => 'Moti Nagar'
]
,
function($value) {
$this->crud->addClause('where', 'assembly_name', $value);

});


$this->crud->addFilter([// add a "simple" filter called Draft
'type' => 'dropdown',
'name' => 'name',
'label' => 'Name'
], ['C L GUPTA ADVOCATE'=>'C L GUPTA ADVOCATE',
'DEEPAK KUMAR'=>'DEEPAK KUMAR',
'VIJENDER GUPTA'=>'VIJENDER GUPTA',
'SUKHBIR SINGH'=>'SUKHBIR SINGH',
'RAJU'=>'RAJU',
'SARABJIT SINGH'=>'SARABJIT SINGH',
'Rituraj Govind'=>'Rituraj Govind',
'Anil Jha'=>'Anil Jha',
'Pratyush Kanth'=>'Pratyush Kanth',
'D. N. Bhagat Kushwaha' =>'D. N. Bhagat Kushwaha',
'Abhinav Prajapati'=>'Abhinav Prajapati',
'Rajinder Kumar' =>'Rajinder Kumar'

], // the simple filter has no values, just the "Draft" label specified above
function($value) { // if the filter is active (the GET parameter "draft" exits)

$this->crud->addClause('where', 'name', 'LIKE', "%$value%");

});
$this->crud->addFilter([// add a "simple" filter called Draft
'type' => 'dropdown',
'name' => 'party_name',
'label' => 'Party Name'
], [
'AAP'=>'AAP','BSP'=>'BSP','NDA'=>'NDA','INC'=>'INC','DMKP'=>'DMKP',
'IND'=>'IND','NCP'=>'NCP','SHIV SENA'=>'SHIV SENA','BJP'=>'BJP','NOTA'=>'NOTA'
],
function($value) {
$this->crud->addClause('where', 'party_name', 'LIKE', "%$value%");

});

$name = $this->request->input('name');
$party_name = $this->request->input('party_name');
$assembly_name = $this->request->input('assembly_name');
$parliamentary = $this->request->input('parliamentary');
$state = $this->request->input('state');
$data = [$state,$parliamentary,$name,$party_name];

$query = 'SELECT * FROM `results` WHERE state like ' .$state.' AND '
. 'parliamentary like '.$parliamentary.' AND '
.'assembly_name like '.$assembly_name.' AND '
.'party_name like '.$party_name.' AND '
.'name like '.$name;



//view($this->crud->getListView())->with('para',$data);

$this->crud->addColumns([
'state', 'parliamentary', 'assembly_name', 'area', 'party_name', 'name', 'no_of_cast_votes'
]);

$this->crud->limit(5);
//print_r($this->crud->query);
//$this->crud->update($id, $data);


//dd($query);

$this->crud->removeAllButtonsFromStack('line');
$this->crud->removeButton('create');
}


I am new backpack-demo laravel admin repo.
I want to fetch the filter data on basis of parameter and pass to list view .i have tried this
1.Made function and pass data $value .
public function pass($field,$value){



    $query = "SELECT * FROM `results` WHERE ";

if($field == 'state' )
$query= $query.`state`.'='. $value.' or';
if($field == 'parliamentary' )
$query= $query.`parliamentary`.'='. $value.' or';
if($field == 'assembly_name' )
$query= $query.`assembly_name`.'='. $value.' or';
if($field == 'area' )
$query= $query.`area`.'='. $value.' or';
if($field == 'party_name' )
$query= $query.`party_name`.'='. $value.' or';
if($field == 'name' )
$query= $query.`name`.'='. $value .'limit 1,10';

$datas = DB::select($query);

view($this->crud->getListView())->with('datas',$datas);
}


please help ?



I want to fetch the filter data on different filter and pass to view.Is there way to get the value of filter or query or data after query execution










share|improve this question



























    0














      public function setup() {

    /*
    |--------------------------------------------------------------------------
    | BASIC CRUD INFORMATION
    |--------------------------------------------------------------------------
    */
    $this->crud->setModel('AppModelsResult');
    $this->crud->setRoute(config('backpack.base.route_prefix') . '/result');
    $this->crud->setEntityNameStrings('result', 'results');
    $value = '';
    /*
    |--------------------------------------------------------------------------
    | BASIC CRUD INFORMATION
    |--------------------------------------------------------------------------
    */


    $this->crud->addFilter([// add a "simple" filter called Draft
    'type' => 'dropdown',
    'name' => 'state',
    'label' => 'State'
    ], [
    'Delhi' => 'Delhi',
    'Uttar Pradesh' => 'Uttar Pradesh',
    'Tamil Nadu' => 'Tamil Nadu',
    'Uttrakhand' => 'Uttrakhand',
    ],


    $this->crud->addClause('where', 'state', 'LIKE', "%$value%");



    });
    $this->crud->addFilter([
    'type' => 'dropdown',
    'name' => 'parliamentary',
    'label' => 'Parliamentary'
    ], [
    'delhi' => 'Delhi',
    'Uttar Pradesh' => 'Uttar Pradesh',
    'Tamil Nadu' => 'Tamil Nadu',
    'Uttrakhand' => 'Uttrakhand',
    ],
    function($value) { )
    $this->crud->addClause('where', 'parliamentary', 'LIKE', "%$value%");

    });
    $this->crud->addFilter([// add a "simple" filter called Draft
    'type' => 'dropdown',
    'name' => 'assembly_name',
    'label' => 'Assembly Name'
    ], [
    'Narela' => 'Narela', 'Burari' => 'Burari', 'Timarpur' => 'Timarpur',
    'Adarsh Nagar' => 'Adarsh Nagar', 'Badli' => 'Badli', 'Rithala' => 'Rithala',
    'Bawana' => 'Bawana', 'Mundka', 'Kirari' => 'Kirari', 'Sultan Pur Majra' => 'Sultan Pur Majra',
    'Nangloi' => 'Nangloi', 'Jat Mangol Puri' => 'Jat Mangol Puri', 'Rohini' => 'Rohini',
    'Shalimar Bagh' => 'Shalimar Bagh', 'Shakur Basti' => 'Shakur Basti',
    'Tri Nagar' => 'Tri Nagar', 'Wazirpur' => 'Wazirpur', 'Model Town' => 'Model Town',
    'Sadar Bazar' => 'Sadar Bazar', 'Chandni Chowk' => 'Chandni Chowk',
    'Matia Mahal' => 'Matia Mahal', 'Ballimaran' => 'Ballimaran',
    'Karol Bagh' => 'Karol Bagh', 'Patel Nagar' => 'Patel Nagar',
    'Moti Nagar' => 'Moti Nagar'
    ]
    ,
    function($value) {
    $this->crud->addClause('where', 'assembly_name', $value);

    });


    $this->crud->addFilter([// add a "simple" filter called Draft
    'type' => 'dropdown',
    'name' => 'name',
    'label' => 'Name'
    ], ['C L GUPTA ADVOCATE'=>'C L GUPTA ADVOCATE',
    'DEEPAK KUMAR'=>'DEEPAK KUMAR',
    'VIJENDER GUPTA'=>'VIJENDER GUPTA',
    'SUKHBIR SINGH'=>'SUKHBIR SINGH',
    'RAJU'=>'RAJU',
    'SARABJIT SINGH'=>'SARABJIT SINGH',
    'Rituraj Govind'=>'Rituraj Govind',
    'Anil Jha'=>'Anil Jha',
    'Pratyush Kanth'=>'Pratyush Kanth',
    'D. N. Bhagat Kushwaha' =>'D. N. Bhagat Kushwaha',
    'Abhinav Prajapati'=>'Abhinav Prajapati',
    'Rajinder Kumar' =>'Rajinder Kumar'

    ], // the simple filter has no values, just the "Draft" label specified above
    function($value) { // if the filter is active (the GET parameter "draft" exits)

    $this->crud->addClause('where', 'name', 'LIKE', "%$value%");

    });
    $this->crud->addFilter([// add a "simple" filter called Draft
    'type' => 'dropdown',
    'name' => 'party_name',
    'label' => 'Party Name'
    ], [
    'AAP'=>'AAP','BSP'=>'BSP','NDA'=>'NDA','INC'=>'INC','DMKP'=>'DMKP',
    'IND'=>'IND','NCP'=>'NCP','SHIV SENA'=>'SHIV SENA','BJP'=>'BJP','NOTA'=>'NOTA'
    ],
    function($value) {
    $this->crud->addClause('where', 'party_name', 'LIKE', "%$value%");

    });

    $name = $this->request->input('name');
    $party_name = $this->request->input('party_name');
    $assembly_name = $this->request->input('assembly_name');
    $parliamentary = $this->request->input('parliamentary');
    $state = $this->request->input('state');
    $data = [$state,$parliamentary,$name,$party_name];

    $query = 'SELECT * FROM `results` WHERE state like ' .$state.' AND '
    . 'parliamentary like '.$parliamentary.' AND '
    .'assembly_name like '.$assembly_name.' AND '
    .'party_name like '.$party_name.' AND '
    .'name like '.$name;



    //view($this->crud->getListView())->with('para',$data);

    $this->crud->addColumns([
    'state', 'parliamentary', 'assembly_name', 'area', 'party_name', 'name', 'no_of_cast_votes'
    ]);

    $this->crud->limit(5);
    //print_r($this->crud->query);
    //$this->crud->update($id, $data);


    //dd($query);

    $this->crud->removeAllButtonsFromStack('line');
    $this->crud->removeButton('create');
    }


    I am new backpack-demo laravel admin repo.
    I want to fetch the filter data on basis of parameter and pass to list view .i have tried this
    1.Made function and pass data $value .
    public function pass($field,$value){



        $query = "SELECT * FROM `results` WHERE ";

    if($field == 'state' )
    $query= $query.`state`.'='. $value.' or';
    if($field == 'parliamentary' )
    $query= $query.`parliamentary`.'='. $value.' or';
    if($field == 'assembly_name' )
    $query= $query.`assembly_name`.'='. $value.' or';
    if($field == 'area' )
    $query= $query.`area`.'='. $value.' or';
    if($field == 'party_name' )
    $query= $query.`party_name`.'='. $value.' or';
    if($field == 'name' )
    $query= $query.`name`.'='. $value .'limit 1,10';

    $datas = DB::select($query);

    view($this->crud->getListView())->with('datas',$datas);
    }


    please help ?



    I want to fetch the filter data on different filter and pass to view.Is there way to get the value of filter or query or data after query execution










    share|improve this question

























      0












      0








      0







        public function setup() {

      /*
      |--------------------------------------------------------------------------
      | BASIC CRUD INFORMATION
      |--------------------------------------------------------------------------
      */
      $this->crud->setModel('AppModelsResult');
      $this->crud->setRoute(config('backpack.base.route_prefix') . '/result');
      $this->crud->setEntityNameStrings('result', 'results');
      $value = '';
      /*
      |--------------------------------------------------------------------------
      | BASIC CRUD INFORMATION
      |--------------------------------------------------------------------------
      */


      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'state',
      'label' => 'State'
      ], [
      'Delhi' => 'Delhi',
      'Uttar Pradesh' => 'Uttar Pradesh',
      'Tamil Nadu' => 'Tamil Nadu',
      'Uttrakhand' => 'Uttrakhand',
      ],


      $this->crud->addClause('where', 'state', 'LIKE', "%$value%");



      });
      $this->crud->addFilter([
      'type' => 'dropdown',
      'name' => 'parliamentary',
      'label' => 'Parliamentary'
      ], [
      'delhi' => 'Delhi',
      'Uttar Pradesh' => 'Uttar Pradesh',
      'Tamil Nadu' => 'Tamil Nadu',
      'Uttrakhand' => 'Uttrakhand',
      ],
      function($value) { )
      $this->crud->addClause('where', 'parliamentary', 'LIKE', "%$value%");

      });
      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'assembly_name',
      'label' => 'Assembly Name'
      ], [
      'Narela' => 'Narela', 'Burari' => 'Burari', 'Timarpur' => 'Timarpur',
      'Adarsh Nagar' => 'Adarsh Nagar', 'Badli' => 'Badli', 'Rithala' => 'Rithala',
      'Bawana' => 'Bawana', 'Mundka', 'Kirari' => 'Kirari', 'Sultan Pur Majra' => 'Sultan Pur Majra',
      'Nangloi' => 'Nangloi', 'Jat Mangol Puri' => 'Jat Mangol Puri', 'Rohini' => 'Rohini',
      'Shalimar Bagh' => 'Shalimar Bagh', 'Shakur Basti' => 'Shakur Basti',
      'Tri Nagar' => 'Tri Nagar', 'Wazirpur' => 'Wazirpur', 'Model Town' => 'Model Town',
      'Sadar Bazar' => 'Sadar Bazar', 'Chandni Chowk' => 'Chandni Chowk',
      'Matia Mahal' => 'Matia Mahal', 'Ballimaran' => 'Ballimaran',
      'Karol Bagh' => 'Karol Bagh', 'Patel Nagar' => 'Patel Nagar',
      'Moti Nagar' => 'Moti Nagar'
      ]
      ,
      function($value) {
      $this->crud->addClause('where', 'assembly_name', $value);

      });


      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'name',
      'label' => 'Name'
      ], ['C L GUPTA ADVOCATE'=>'C L GUPTA ADVOCATE',
      'DEEPAK KUMAR'=>'DEEPAK KUMAR',
      'VIJENDER GUPTA'=>'VIJENDER GUPTA',
      'SUKHBIR SINGH'=>'SUKHBIR SINGH',
      'RAJU'=>'RAJU',
      'SARABJIT SINGH'=>'SARABJIT SINGH',
      'Rituraj Govind'=>'Rituraj Govind',
      'Anil Jha'=>'Anil Jha',
      'Pratyush Kanth'=>'Pratyush Kanth',
      'D. N. Bhagat Kushwaha' =>'D. N. Bhagat Kushwaha',
      'Abhinav Prajapati'=>'Abhinav Prajapati',
      'Rajinder Kumar' =>'Rajinder Kumar'

      ], // the simple filter has no values, just the "Draft" label specified above
      function($value) { // if the filter is active (the GET parameter "draft" exits)

      $this->crud->addClause('where', 'name', 'LIKE', "%$value%");

      });
      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'party_name',
      'label' => 'Party Name'
      ], [
      'AAP'=>'AAP','BSP'=>'BSP','NDA'=>'NDA','INC'=>'INC','DMKP'=>'DMKP',
      'IND'=>'IND','NCP'=>'NCP','SHIV SENA'=>'SHIV SENA','BJP'=>'BJP','NOTA'=>'NOTA'
      ],
      function($value) {
      $this->crud->addClause('where', 'party_name', 'LIKE', "%$value%");

      });

      $name = $this->request->input('name');
      $party_name = $this->request->input('party_name');
      $assembly_name = $this->request->input('assembly_name');
      $parliamentary = $this->request->input('parliamentary');
      $state = $this->request->input('state');
      $data = [$state,$parliamentary,$name,$party_name];

      $query = 'SELECT * FROM `results` WHERE state like ' .$state.' AND '
      . 'parliamentary like '.$parliamentary.' AND '
      .'assembly_name like '.$assembly_name.' AND '
      .'party_name like '.$party_name.' AND '
      .'name like '.$name;



      //view($this->crud->getListView())->with('para',$data);

      $this->crud->addColumns([
      'state', 'parliamentary', 'assembly_name', 'area', 'party_name', 'name', 'no_of_cast_votes'
      ]);

      $this->crud->limit(5);
      //print_r($this->crud->query);
      //$this->crud->update($id, $data);


      //dd($query);

      $this->crud->removeAllButtonsFromStack('line');
      $this->crud->removeButton('create');
      }


      I am new backpack-demo laravel admin repo.
      I want to fetch the filter data on basis of parameter and pass to list view .i have tried this
      1.Made function and pass data $value .
      public function pass($field,$value){



          $query = "SELECT * FROM `results` WHERE ";

      if($field == 'state' )
      $query= $query.`state`.'='. $value.' or';
      if($field == 'parliamentary' )
      $query= $query.`parliamentary`.'='. $value.' or';
      if($field == 'assembly_name' )
      $query= $query.`assembly_name`.'='. $value.' or';
      if($field == 'area' )
      $query= $query.`area`.'='. $value.' or';
      if($field == 'party_name' )
      $query= $query.`party_name`.'='. $value.' or';
      if($field == 'name' )
      $query= $query.`name`.'='. $value .'limit 1,10';

      $datas = DB::select($query);

      view($this->crud->getListView())->with('datas',$datas);
      }


      please help ?



      I want to fetch the filter data on different filter and pass to view.Is there way to get the value of filter or query or data after query execution










      share|improve this question













        public function setup() {

      /*
      |--------------------------------------------------------------------------
      | BASIC CRUD INFORMATION
      |--------------------------------------------------------------------------
      */
      $this->crud->setModel('AppModelsResult');
      $this->crud->setRoute(config('backpack.base.route_prefix') . '/result');
      $this->crud->setEntityNameStrings('result', 'results');
      $value = '';
      /*
      |--------------------------------------------------------------------------
      | BASIC CRUD INFORMATION
      |--------------------------------------------------------------------------
      */


      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'state',
      'label' => 'State'
      ], [
      'Delhi' => 'Delhi',
      'Uttar Pradesh' => 'Uttar Pradesh',
      'Tamil Nadu' => 'Tamil Nadu',
      'Uttrakhand' => 'Uttrakhand',
      ],


      $this->crud->addClause('where', 'state', 'LIKE', "%$value%");



      });
      $this->crud->addFilter([
      'type' => 'dropdown',
      'name' => 'parliamentary',
      'label' => 'Parliamentary'
      ], [
      'delhi' => 'Delhi',
      'Uttar Pradesh' => 'Uttar Pradesh',
      'Tamil Nadu' => 'Tamil Nadu',
      'Uttrakhand' => 'Uttrakhand',
      ],
      function($value) { )
      $this->crud->addClause('where', 'parliamentary', 'LIKE', "%$value%");

      });
      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'assembly_name',
      'label' => 'Assembly Name'
      ], [
      'Narela' => 'Narela', 'Burari' => 'Burari', 'Timarpur' => 'Timarpur',
      'Adarsh Nagar' => 'Adarsh Nagar', 'Badli' => 'Badli', 'Rithala' => 'Rithala',
      'Bawana' => 'Bawana', 'Mundka', 'Kirari' => 'Kirari', 'Sultan Pur Majra' => 'Sultan Pur Majra',
      'Nangloi' => 'Nangloi', 'Jat Mangol Puri' => 'Jat Mangol Puri', 'Rohini' => 'Rohini',
      'Shalimar Bagh' => 'Shalimar Bagh', 'Shakur Basti' => 'Shakur Basti',
      'Tri Nagar' => 'Tri Nagar', 'Wazirpur' => 'Wazirpur', 'Model Town' => 'Model Town',
      'Sadar Bazar' => 'Sadar Bazar', 'Chandni Chowk' => 'Chandni Chowk',
      'Matia Mahal' => 'Matia Mahal', 'Ballimaran' => 'Ballimaran',
      'Karol Bagh' => 'Karol Bagh', 'Patel Nagar' => 'Patel Nagar',
      'Moti Nagar' => 'Moti Nagar'
      ]
      ,
      function($value) {
      $this->crud->addClause('where', 'assembly_name', $value);

      });


      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'name',
      'label' => 'Name'
      ], ['C L GUPTA ADVOCATE'=>'C L GUPTA ADVOCATE',
      'DEEPAK KUMAR'=>'DEEPAK KUMAR',
      'VIJENDER GUPTA'=>'VIJENDER GUPTA',
      'SUKHBIR SINGH'=>'SUKHBIR SINGH',
      'RAJU'=>'RAJU',
      'SARABJIT SINGH'=>'SARABJIT SINGH',
      'Rituraj Govind'=>'Rituraj Govind',
      'Anil Jha'=>'Anil Jha',
      'Pratyush Kanth'=>'Pratyush Kanth',
      'D. N. Bhagat Kushwaha' =>'D. N. Bhagat Kushwaha',
      'Abhinav Prajapati'=>'Abhinav Prajapati',
      'Rajinder Kumar' =>'Rajinder Kumar'

      ], // the simple filter has no values, just the "Draft" label specified above
      function($value) { // if the filter is active (the GET parameter "draft" exits)

      $this->crud->addClause('where', 'name', 'LIKE', "%$value%");

      });
      $this->crud->addFilter([// add a "simple" filter called Draft
      'type' => 'dropdown',
      'name' => 'party_name',
      'label' => 'Party Name'
      ], [
      'AAP'=>'AAP','BSP'=>'BSP','NDA'=>'NDA','INC'=>'INC','DMKP'=>'DMKP',
      'IND'=>'IND','NCP'=>'NCP','SHIV SENA'=>'SHIV SENA','BJP'=>'BJP','NOTA'=>'NOTA'
      ],
      function($value) {
      $this->crud->addClause('where', 'party_name', 'LIKE', "%$value%");

      });

      $name = $this->request->input('name');
      $party_name = $this->request->input('party_name');
      $assembly_name = $this->request->input('assembly_name');
      $parliamentary = $this->request->input('parliamentary');
      $state = $this->request->input('state');
      $data = [$state,$parliamentary,$name,$party_name];

      $query = 'SELECT * FROM `results` WHERE state like ' .$state.' AND '
      . 'parliamentary like '.$parliamentary.' AND '
      .'assembly_name like '.$assembly_name.' AND '
      .'party_name like '.$party_name.' AND '
      .'name like '.$name;



      //view($this->crud->getListView())->with('para',$data);

      $this->crud->addColumns([
      'state', 'parliamentary', 'assembly_name', 'area', 'party_name', 'name', 'no_of_cast_votes'
      ]);

      $this->crud->limit(5);
      //print_r($this->crud->query);
      //$this->crud->update($id, $data);


      //dd($query);

      $this->crud->removeAllButtonsFromStack('line');
      $this->crud->removeButton('create');
      }


      I am new backpack-demo laravel admin repo.
      I want to fetch the filter data on basis of parameter and pass to list view .i have tried this
      1.Made function and pass data $value .
      public function pass($field,$value){



          $query = "SELECT * FROM `results` WHERE ";

      if($field == 'state' )
      $query= $query.`state`.'='. $value.' or';
      if($field == 'parliamentary' )
      $query= $query.`parliamentary`.'='. $value.' or';
      if($field == 'assembly_name' )
      $query= $query.`assembly_name`.'='. $value.' or';
      if($field == 'area' )
      $query= $query.`area`.'='. $value.' or';
      if($field == 'party_name' )
      $query= $query.`party_name`.'='. $value.' or';
      if($field == 'name' )
      $query= $query.`name`.'='. $value .'limit 1,10';

      $datas = DB::select($query);

      view($this->crud->getListView())->with('datas',$datas);
      }


      please help ?



      I want to fetch the filter data on different filter and pass to view.Is there way to get the value of filter or query or data after query execution







      dictionary filter view backpack-for-laravel






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 at 6:21









      codegiver

      12




      12





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387330%2ffetch-and-passing-filter-data-in-list-view-in-backpack-demo-laravel%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387330%2ffetch-and-passing-filter-data-in-list-view-in-backpack-demo-laravel%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          If I really need a card on my start hand, how many mulligans make sense? [duplicate]

          Alcedinidae

          Can an atomic nucleus contain both particles and antiparticles? [duplicate]