Esempio n. 1
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     //fire email event after request is made
     ContactRequest::Created(function ($contactRequest) {
         //event(new ContactRequestCreated($contactRequest));
     });
 }
Esempio n. 2
0
 public function requestInfoHome(Request $request)
 {
     $text = $request->first_name . ' ' . $request->last_name . ' has requested more information. You can reach them at ' . $request->email . ' and ' . $request->phone . '. COMMENTS: ' . $request->comments;
     //add person to database
     $contact = ContactRequest::Create(['name' => $request->first_name . ' ' . $request->last_name, 'email' => $request->email, 'phone' => $request->phone . $request->carrier]);
     Mail::raw($text, function ($message) {
         $message->from('*****@*****.**');
         $message->to('*****@*****.**');
         $message->subject('MORE INFORMATION REQUESTED!');
     });
     return back();
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function edit(Request $request)
 {
     $request_id = $request->input('request_id');
     $updateSucceeded = ContactRequest::where('id', $request_id)->update(array('state' => false));
     if ($updateSucceeded) {
         $returnValue['status'] = 200;
         $returnValue['message'] = "OK";
         return Response::json($returnValue, 200);
     }
     $returnValue['status'] = 400;
     $returnValue['error_message'] = "An error occurred while trying to delete a request.";
     return Response::json($returnValue, 400);
 }
Esempio n. 4
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     /*
     curl -u YOUR_SECRET_KEY: -H "Content-Type: application/json" -H "X-Ionic-Application-Id: YOUR_APP_ID" https://push.ionic.io/api/v1/push -d '{"tokens": ["YOUR_TOKEN"],"notification":{"alert":"Hello world."}}'
     */
     $numbers = ContactRequest::all()->pluck('phone');
     $alert = Alert::Create(['message' => $this->argument('message')]);
     /*$tokens = DeviceToken::all('token')->pluck('token');
     \Log::info('Tokens', $tokens->toArray());
     $fields = array
     (
     	"tokens"=> $tokens,
       "notification" => [
         'alert' => $this->argument('message')]
     );
     
     $headers = array
     (
     	'X-Ionic-Application-Id: 35509efc',
     	'Content-Type: application/json'
     );
     $username='******';
     $ch = curl_init();
     curl_setopt( $ch,CURLOPT_URL, 'https://push.ionic.io/api/v1/push' );
     curl_setopt( $ch,CURLOPT_POST, true );
     curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
     curl_setopt($ch, CURLOPT_USERPWD, "$username");
     curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
     curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
     curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
     $result = curl_exec($ch );
     curl_close( $ch );
     echo $result;*/
     foreach ($numbers as $number) {
         try {
             Mail::raw($this->argument('message'), function ($message) use($number) {
                 $message->from('*****@*****.**');
                 $message->to($number);
                 $message->subject('New Info!');
             });
         } catch (Exception $e) {
             break;
         }
     }
 }
 public function store(Request $request)
 {
     //VALIDATE
     $this->validate($request, ['name' => 'required', 'email' => 'required', 'phone' => 'required']);
     return ContactRequest::Create($request->all());
 }