skip to Main Content

Im new to Laravel Packpack. My issue is I have filters using this code

$this->crud->addFilter(
            ['name' => 'created_at', 'type' => 'date_range', 'label' => 'Bid Date'],
            false,
            function ($value) {
                $dates = json_decode($value);
                $this->crud->addClause('where', 'created_at', '>=', $dates->from);
                $this->crud->addClause('where', 'created_at', '<=', $dates->to . ' 23:59:59');
            });
        $this->crud->addFilter(
            ['name' => 'name', 'type' => 'text', 'label' => 'Name'],
            false, 
            function ($value) {
                $this->crud->addClause('where', 'name', 'LIKE', "%$value%");
            });
        $this->crud->addFilter(
            ['name' => 'email', 'type' => 'text', 'label' => 'Email'],
            false, 
            function ($value) {
                $this->crud->addClause('where', 'email', 'LIKE', "%$value%");
            });

It shows the filter like the image below but if Im trying to click it, it doesnt do anything.

enter image description here

Can you share anything to me to fix this? Thank you so much

2

Answers


  1. Chosen as BEST ANSWER

    Done my solution was the cdn of bootstrap.min.js and popper.js is broken :)


  2. Here’s an example modification for debugging purposes:

      $this->crud->addFilter(
        ['name' => 'created_at', 'type' => 'date_range', 'label' => 'Bid Date'],
        false,
        function ($value) {
            $dates = json_decode($value);
            $this->crud->addClause('where', 'created_at', '>=', $dates->from);
            $this->crud->addClause('where', 'created_at', '<=', $dates->to . ' 23:59:59');
        }
    );
    
    $this->crud->addFilter(
        ['name' => 'name', 'type' => 'text', 'label' => 'Name'],
        false, 
        function ($value) {
            $this->crud->addClause('where', 'name', 'LIKE', "%$value%");
        }
    );
    
    $this->crud->addFilter(
        ['name' => 'email', 'type' => 'text', 'label' => 'Email'],
        false, 
        function ($value) {
            $this->crud->addClause('where', 'email', 'LIKE', "%$value%");
        }
    );
    

    Please check that.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search