public function postOccasion()
 {
     $input = Input::all();
     $name = $input['name'];
     //$id	  = $input['user_id'];
     $start = $input['start_time'];
     $end = $input['end_time'];
     $ts_start = Carbon::createFromTimeStamp($start);
     $ts_end = Carbon::createFromTimeStamp($end);
     $occasion = new Occasion();
     $occasion->name = $name;
     $occasion->start = $ts_start->toDateTimeString();
     $occasion->end = $ts_end->toDateTimeString();
     $occasion->save();
     //$occasion->users()->attach($id);
     return $occasion;
 }
Пример #2
0
 public function sendMessage()
 {
     //Twilio::message('+15195805110', 'This is a test!');
     // $data = array('hey!');
     // Mail::send('emails.invite', $data, function($message)
     // {
     //     $message->to('*****@*****.**', 'Jane Doe')->subject('This is a demo!');
     // });
     /*
     		$data = array();
     
     			Mail::send('emails.invite', $data, function($message) 
     			{
     			    $message->to("*****@*****.**", 'Jane Doe')->subject('EVent has been completed!');
     			});
     */
     $users = Occasion::find(1)->users()->get();
     $data = array('temp');
     $users = $users->each(function ($user) use($data) {
         Mail::send('emails.invite', $data, function ($message) use($user) {
             $message->to("*****@*****.**", 'Jane Doe')->subject('EVent has been completed!');
         });
     });
     /*
     for ($i = 0; i < $users->count(); $i++) {
     	
     	Mail::send('emails.invite', $data, function($message) use ($users->get())
     	{
     	    $message->to('*****@*****.**', 'Jane Doe')->subject('EVent has been completed!');
     	});
     
     }
     */
     /*
     
     	$app_id = 'jVmr9Q4ItzKs2abze4T2mRvECJ8AxMwCKT5G8anC';
     	$rest_key = 'hNv7GwawFKdvpyb6B6u8sLqlSQMW3YWWRQeKVll7';
     	$master_key = 'wzwEOPsb5w45qWQQVJSCqTtL6yvD82Y90SiVDh4y';
     
     
     	ParseClient::initialize( $app_id, $rest_key, $master_key );
     
     
     	$data = array("alert" => "Hejhrfbehed!");
     
     	$query = ParseInstallation::query();
     
     	$query->equalTo("device_id", "1");
     	ParsePush::send(array(
     	  "where" => $query,
     	  "data" => $data
     	));
     */
 }