Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. +-------------------------------+
  2. | id | name | code |
  3. ---------------------------------
  4. | 1 | Employee 1 | A1 |
  5. | 2 | Employee 2 | A2 |
  6. | ... | ... | ... |
  7. +-------------------------------+
  8.  
  9. SELECT name FROM employee WHERE code LIKE A1
  10.  
  11. $this->crud->addFilter([
  12. 'type' => 'select2',
  13. 'name' => 'branch_code',
  14. 'label' => 'Filter',
  15. ],
  16. function() {
  17. return Employee::select('code')->distinct()->get()->pluck('code')->toArray();
  18. },
  19. function($value) {
  20. $this->crud->addClause('where', 'code', $value);
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement