public function multiple_upload()
 {
     // getting all of the post data
     $files = Input::file('docs');
     // Making counting of uploaded images
     $file_count = count($files);
     // start count how many uploaded
     foreach ($files as $file) {
         $rules = array('file' => 'required');
         //'required|mimes:png,gif,jpeg,txt,pdf,doc'
         $validator = Validator::make(array('file' => $file), $rules);
         if ($validator->passes()) {
             $user_id = \Request::get('user_id');
             $ref = \Request::get('referencia');
             $hbl = \Request::get('hbl');
             $armador = \Request::get('armador');
             $destinationPath = 'upload/documentos/' . $user_id;
             $filename = $file->getClientOriginalName();
             $upload_success = $file->move($destinationPath, $filename);
             File::create(['name' => $filename, 'referencia' => $ref, 'user_id' => $user_id, 'hbl' => $hbl, 'armador' => $armador]);
         }
     }
     if ($file_count == 2) {
         $user_id = \Request::get('user_id');
         $usuario = User::find($user_id);
         $agente = DB::table("agentes")->where('nome', '=', $usuario->empresa)->get();
         foreach ($agente as $key) {
         }
         $ref = \Request::get('referencia');
         $agente1 = agente::find($key->id);
         $mbl = Mbl::where('NMbl', $ref)->get();
         foreach ($mbl as $item) {
         }
         if (!empty($item->id)) {
             DB::table('mbls')->where('id', '=', $item->id)->update(['prealerta' => '1']);
         } else {
             Mail::raw('O Pré-Alerta referente ao Mbl ' . $ref . ',  recebido a poucos minutos não está cadastrado no sistem ainda - 
             OBS: isto é um teste do sistema', function ($m) {
                 $m->from('*****@*****.**', 'PRÉ-Alerta');
                 $m->to('*****@*****.**')->cc('*****@*****.**')->subject('Pré-alerta');
             });
         }
         Mail::raw('RECEBEMOS PRÉ-ALERTA REFERENTE AO MBL ' . $ref . ',  Obrigado', function ($m) use($agente1) {
             $m->from('*****@*****.**', 'PRÉ-Alerta');
             $m->to($agente1->email1)->subject('Pré-alerta');
         });
         return Redirect::to('fileup');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     agente::destroy($id);
     Session::flash('flash_message', 'agente successfully deleted!');
     return redirect('agente');
 }