/**
  * Metodo para hacer la busqueda de un documente
  */
 public static function search()
 {
     $items = array();
     $search = '';
     if (Input::get('search')) {
         $search = Input::get('search');
         $arrparam = explode(' ', $search);
         $items = Attachment::whereNested(function ($q) use($arrparam) {
             $p = $arrparam[0];
             $q->whereNested(function ($q) use($p) {
                 $q->where('name', 'LIKE', '%' . $p . '%');
                 $q->orwhere('name', 'LIKE', '%' . $p . '%');
             });
             $c = count($arrparam);
             if ($c > 1) {
                 //para no repetir el primer elemento
                 //foreach ($arrparam as $p) {
                 for ($i = 1; $i < $c; $i++) {
                     $p = $arrparam[$i];
                     $q->whereNested(function ($q) use($p) {
                         $q->where('name', 'LIKE', '%' . $p . '%');
                         $q->orwhere('name', 'LIKE', '%' . $p . '%');
                     }, 'OR');
                 }
             }
         })->whereNull('deleted_at')->orderBy('name', 'ASC')->paginate(10);
         return View::make('attachment.view_attachment', compact('items', 'search'));
     }
 }