public function getAsap() { $records = Emails::all(); foreach ($records as $record) { $receive_alert = $record->receive_alert; } if ($receive_alert = 'ASAP') { $records = Emails::where('receive_alert', $receive_alert)->get(); foreach ($records as $record) { $id = $record->user_id; $emls = User::where('id', $id)->get(); foreach ($emls as $eml) { $adr = $eml->email; } $property = Profolio::where('asap', 1)->get(); if ($property->isEmpty()) { echo "no property added"; } else { $to = $adr; $subject = 'New property Add on zameen jayedad'; $message = null; foreach ($property as $propertys) { $message .= '<html> <body> <table width="740px;" class="MsoTableLightShadingAccent1" border="1" cellspacing="0" cellpadding="0" style="color:#333; border-collapse:collapse;border:none; font-family: Helvetica, Arial, sans-serif; text-align: center; width=740px;"> <tr> <td align="center" width="250px;" style="border: 1px solid #333; width=150px; transition: all 0.3s; background: #FAFAFA; text-align: center; " ><b> App Type </b></td> <td align="center" style="border: 1px solid #333; width=370px; transition: all 0.3s; background: #FAFAFA; text-align: center; " >' . $propertys->property_type . '</td> </tr> <tr> <td align="center" width="250px;" style="border: 1px solid #333; width=150px; transition: all 0.3s; background: #FAFAFA; text-align: center; " ><b> purpose </b></td> <td align="center" style="border: 1px solid #333; width=370px; transition: all 0.3s; background: #FAFAFA; text-align: center; " >' . $propertys->purpose . '</td> </tr> <tr> <td align="center" width="250px;" style="border: 1px solid #333; width=150px; transition: all 0.3s; background: #FAFAFA; text-align: center; " ><b> Address </b></td> <td align="center" style="border: 1px solid #333; width=370px; transition: all 0.3s; background: #FAFAFA; text-align: center; " >' . $propertys->location . '</td> </tr> <tr> <td align="center" width="250px;" style="border: 1px solid #333; width=150px; transition: all 0.3s; background: #FAFAFA; text-align: center; " ><b> photo </b></td> <td align="center" style="border: 1px solid #333; width=370px; transition: all 0.3s; background: #FAFAFA; text-align: center; " ><img width="200" height="150" src="http://zameenjayedad.com.pk/uploads/photos/' . $propertys->photo . '"</td> </tr> <tr> <td align="center" width="250px;" style="border: 1px solid #333; width=150px; transition: all 0.3s; background: #FAFAFA; text-align: center; " ><b> App Logo </b></td> <td align="center" style="border: 1px solid #333; width=370px; transition: all 0.3s; background: #FAFAFA; text-align: center; " > <a href="http://zameenjayedad.com.pk/dashboard/listing/guest/' . $propertys->id . '">Detail</a></td> </tr> </table> </body> </html> <br/>'; } // $URL ='Property type :'.$propertys->property_type.'<br/>'.'purpose :'.$propertys->purpose.'<br/>'.'location :'.$propertys->location.'<br/>' // .'budget :'.$propertys->budget.'Area :'.$propertys->l_area.'<br/>'.'Contact Person :'.$propertys->contact_p.'<br/>' // .'Cell Num :'.$propertys->cell.'<br/>'.'Email :'.$propertys->email; // $this->sendTo($adr,array('activationCode'=>$URL)); $headers = "From: " . strip_tags('zameenjayedad.com') . "\r\n"; $headers .= "Reply-To: " . strip_tags('zameenjayedad.com') . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($to, $subject, $message, $headers); DB::table('property')->where('asap', 1)->update(array('asap' => 0)); } } } }