Example #1
0
 /**
  * Default view function
  *
  * @return void
  */
 public function displayTask()
 {
     $filters = Filters::getFilters("{$this->_option}.{$this->_controller}");
     $records = Record::all();
     // Take filters and apply them to the tasks
     if ($filters['search']) {
         foreach ($filters['search'] as $term) {
             $records->where('description', 'LIKE', "%{$term}%", 'and', 1);
             $records->orWhereRelatedHas('task', function ($task) use($term) {
                 $task->where('name', 'LIKE', "%{$term}%");
             }, 1);
         }
     }
     if ($filters['q']) {
         foreach ($filters['q'] as $q) {
             if ($q['o'] == '=' && $q['column'] == 'date') {
                 $q['o'] = 'LIKE';
                 $q['value'] .= '%';
             }
             if ($q['o'] == '!=' && $q['column'] == 'date') {
                 $q['o'] = 'NOT LIKE';
                 $q['value'] .= '%';
             }
             $records->where($q['column'], $q['o'], $q['value']);
         }
     }
     // Display
     $this->view->filters = $filters;
     $this->view->records = $records->paginated()->ordered()->including('task', 'user', 'task.hub');
     $this->view->display();
 }
Example #2
0
 /**
  * Default view function
  *
  * @return void
  */
 public function displayTask()
 {
     $filters = Filters::getFilters("{$this->_option}.{$this->_controller}");
     $tasks = Task::all();
     // Take filters and apply them to the tasks
     if ($filters['search']) {
         foreach ($filters['search'] as $term) {
             $tasks->where('name', 'LIKE', "%{$term}%");
         }
     }
     if ($filters['q']) {
         foreach ($filters['q'] as $q) {
             $tasks->where($q['column'], $q['o'], $q['value']);
         }
     }
     // Display
     $this->view->filters = $filters;
     $this->view->tasks = $tasks->paginated()->ordered()->including('liaison', 'assignee', 'hub');
     $this->view->display();
 }