예제 #1
0
 public function search($search, $id)
 {
     if (!empty($search)) {
         $entries = $this->entry->join('users', 'users.id', '=', 'entries.user_id')->where('users.name', 'LIKE', '%' . $search . '%')->where('project_id', '=', $id);
         if ($entries->count() > 0) {
             return $entries->paginate(5);
         } else {
             $entries = $this->entry->join('users', 'users.id', '=', 'entries.user_id')->where('users.email', 'LIKE', '%' . $search . '%')->where('project_id', '=', $id);
             if ($entries->count() > 0) {
                 return $entries->paginate(5);
             }
         }
     }
 }