예제 #1
0
 public function showEnvios($contest_id)
 {
     if (Auth::user()->rol == 1 || Auth::user()->rol == 2) {
         $envios = Envios::where('id_concurso', $contest_id)->orderBy('id', 'desc')->get();
     } else {
         $envios = Envios::where('id_concurso', $contest_id)->where('id_usuario', Auth::user()->id)->orderBy('id', 'desc')->get();
     }
     $contest = Concurso::find($contest_id);
     return view('contest/envios', ['envios' => $envios, 'contest' => $contest]);
 }
예제 #2
0
파일: Envios.php 프로젝트: DanielAlxx/MOJ
 public static function resuelto($id_problema)
 {
     $envio = Envios::find($id_problema);
     $existe = DB::table('envios')->select(DB::raw('envios.*,count(id) as resuelto'))->where('id_usuario', $envio->id_usuario)->where('id_concurso', $envio->id_concurso)->where('id_problema', $envio->id_problema)->where('veredicto', 1)->get();
     if ($existe) {
         $ans = $existe[0];
         if ($ans->resuelto >= 1) {
             return true;
         }
     }
     return false;
 }
 public function emailDispacher()
 {
     ini_set('xdebug.max_nesting_level', 600);
     $host = json_decode(getenv("HOST"));
     $allMail = Envios::all();
     $config = array();
     $count = 0;
     $num = 0;
     foreach ($allMail as $mail) {
         $clippings = $mail->clippingEnvios;
         foreach ($clippings as $clipping) {
             //dd($clipping);
             $data = Clippings::find($clipping->clipping_id);
             $redata[$num][] = $data;
             $destines = explode(",", $data->cliente->mailing);
             if ($count == 0) {
                 foreach ($destines as $destine) {
                     $config[$num]['mailing'][] = $destine;
                 }
                 $config[$num]['DestineName'] = $data->cliente->nome;
             }
             $config[$num]['attach'][] = public_path() . $data->file_image;
             $count++;
         }
         $count = 0;
         $num++;
     }
     //dd($config);
     for ($i = 0; $i < count($allMail); $i++) {
         $newConfig = $config[$i];
         //dd($redata[$i]);
         $sent = Mail::queue('emails.blank', ["clipping" => $redata[$i], "host" => $host->host], function ($message) use($newConfig) {
             $message->from('*****@*****.**');
             $message->to($newConfig['mailing'])->subject('Clipping Cliente ' . $newConfig['DestineName'] . " " . date('d/m/Y') . " - " . date("H:m:ss"));
             for ($at = 0; $at < count($newConfig['attach']); $at++) {
                 $message->attach($newConfig['attach'][$at]);
             }
         });
     }
 }