本文整理汇总了PHP中Notification::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::create方法的具体用法?PHP Notification::create怎么用?PHP Notification::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Notification::create([]);
}
}
示例2: run
public function run()
{
$faker = Faker::create();
$faker->addProvider(new \Faker\Provider\Base($faker));
foreach (range(1, 10) as $index) {
Notification::create(['title' => $faker->text, 'owner_type' => $faker->randomElement($array = array('terefa', 'cliente', 'agendaevent')), 'owner_id' => $faker->randomElement($array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)), 'user_id' => '1', 'type' => $faker->randomElement($array = array('email', 'notification')), 'status' => $faker->boolean($chanceOfGettingTrue = 50), 'date' => $faker->dateTime($max = 'now')]);
}
}
示例3: run
public function run()
{
Notification::create(['name' => 'retries', 'friendly_name' => 'Server Retry Threshold', 'value' => '5', 'options' => null, 'description' => 'After this many minutes of not being able to connect to a server, issue a notification']);
Notification::create(['name' => 'email.enabled', 'friendly_name' => 'E-Mail Notifications Enabled', 'value' => 'false', 'options' => 'true|false', 'description' => 'Whether or not E-Mail notifications are enabled']);
Notification::create(['name' => 'email.addresses', 'friendly_name' => 'E-Mail Addresses', 'value' => '', 'options' => null, 'description' => 'The email addresses that notifcations are sent to, seperated by a semi-colon (;)', 'in_overview' => 0]);
Notification::create(['name' => 'twitter.enabled', 'friendly_name' => 'Twitter Notifications Enabled', 'value' => 'false', 'options' => 'true|false', 'description' => 'Whether or not Twitter notifications are enabled']);
Notification::create(['name' => 'twitter.key', 'friendly_name' => 'Twitter Consumer Key', 'value' => '', 'options' => null, 'description' => 'Your twitter account consumer key found on https://apps.twitter.com', 'in_overview' => 0]);
Notification::create(['name' => 'hipchat.enabled', 'friendly_name' => 'HipChat Notifications Enabled', 'value' => 'false', 'options' => 'true|false', 'description' => 'Whether or not HipChat notifications are enabled']);
Notification::create(['name' => 'hipchat.room', 'friendly_name' => 'HipChat Room ID', 'value' => '', 'options' => null, 'description' => 'HipChat room ID to send notifications to', 'in_overview' => 0]);
Notification::create(['name' => 'hipchat.auth', 'friendly_name' => 'HipChat Room Auth Token', 'value' => '', 'options' => null, 'description' => 'The HipChat rooms auth token', 'in_overview' => 0]);
Notification::create(['name' => 'pushbullet.enabled', 'friendly_name' => 'PushBullet Notifications Enabled', 'value' => 'false', 'options' => 'true|false', 'description' => 'Whether or not PushBullet notifications are enabled']);
}
示例4: testCreate
/**
* @covers ::create
* @depends testGet
*/
public function testCreate()
{
$expected = new \TMT\model\Notification(array("guid" => "guid1", "timestamp" => "2000-01-01 00:00:00", "message" => "message", "area" => "areaguid", "type" => "type1"));
$mockdb = new \TMT\MockDB();
$mockdb->expectPrepare("INSERT INTO notifications (message, type, area, guid) VALUES (:message, :type, :area, :guid)");
$mockdb->expectExecute(array(':message' => "message", ':type' => "type1", ':area' => "areaguid", ":guid" => "guid1"));
$mockdb->expectPrepare("SELECT * FROM notifications WHERE guid=:guid");
$mockdb->expectExecute(array(':guid' => "guid1"));
$mockdb->setReturnData(array((object) array("guid" => "guid1", "timestamp" => "2000-01-01 00:00:00", "message" => "message", "area" => "areaguid", "type" => "type1")));
$accessor = new Notification($mockdb);
$accessor->setGuidCreator(new MockGuidCreator("guid1"));
$actual = $accessor->create(new \TMT\model\Notification(array("message" => "message", "area" => "areaguid", "type" => "type1")));
$this->assertEquals($expected, $actual);
$mockdb->verify();
}
示例5: createDesignation
public function createDesignation()
{
$in = Input::all();
$rules = ['group' => 'required', 'deadline' => 'required', 'time' => 'required'];
$validation = Validator::make($in, $rules);
if ($validation->passes()) {
$activity = GroupPageActivity::find($in['grouppageactivityID']);
$gpaGroup = GroupPageActivityGroup::create(['grouppageactivityID' => $in['grouppageactivityID'], 'grouppageID' => $in['group'], 'deadline' => $in['deadline'] . ' ' . $in['time']]);
if ($gpaGroup) {
$gpPost = GroupPagePost::create(['grouppageID' => $in['group'], 'StudentID' => Auth::user()->StudentID, 'Message' => '<h5>Activity name:</h5>' . $activity->name . '<br/><h5>Description:</h5>' . $activity->description . '<br/><span class="timeago">Deadline: ' . date(MyDate::getDateFormat(), strtotime($in['deadline'])) . '</span><p>Kindly check your activities Tab</p>']);
Notification::create(['StudentID' => Auth::user()->StudentID, 'grouppageID' => $in['group'], 'grouppageactivityID' => $in['grouppageactivityID'], 'grouppagepostID' => $gpPost->id, 'notificationEventTypeID' => 1, 'seen' => 0]);
}
return Redirect::to('/')->with('message', 'Group activity designation successful')->with('url', '/group/activities/view/' . $in['grouppageactivityID']);
}
return Redirect::to('/')->with('message', 'Error in group activity designation')->with('url', '/group/activities/view/' . $in['grouppageactivityID']);
}
示例6: confirm
public function confirm($app)
{
$this->status = Order::STATUS_PAID_CONFIRM;
$this->save();
$listings = array();
foreach ($this->listings as $idx => $listing) {
Notification::create(['user_id' => $this->user_id, 'receiver_id' => $listing->user_id, 'title' => 'APPROVAL', 'body' => '**Listing #' . $app->hashids->encrypt($listing->id) . ' (' . $listing->description->name . ') has been ordered!**
Someone has purchased your item! Once they have completed their order and received the item, funds will be deposited in your CSGOShop wallet.
You can read more about your wallet [here](' . $app->config->get('core.url') . '/help#wallet).']);
array_push($listings, array('order_id' => (string) $this->id, 'user_id' => (string) $this->user_id, 'item_id' => (string) $listing->item_id, 'bot_id' => (string) $listing->bot_id));
$app->pusher->trigger($listing->user_id, 'notification', array('message' => '1'));
}
Notification::create(['user_id' => $this->user_id, 'receiver_id' => $this->user_id, 'title' => 'APPROVAL', 'body' => '**Payment for Order #' . $app->hashids->encrypt($this->id) . 'has been confirmed!**
Your order has been confirmed and a bot will send you a trade offer soon with your purchased items.']);
$app->pusher->trigger($this->user_id, 'notification', array('message' => '1'));
$app->pusher->trigger('bots', 'paidOrder', $listings);
}
示例7: store_followup
public function store_followup($id)
{
$patient = Patient::find($id);
$patient->first_name = Input::get("firstname");
$patient->middle_name = Input::get("middlename");
$patient->last_name = Input::get("lastname");
$patient->birth_date = Input::get("dob");
$patient->hospital_id = Input::get("hosp_no");
$patient->phone = Input::get("phone");
$patient->facility_id = Input::get("facility");
$patient->save();
//adding patient visit info
$visit = Visit::create(array("patient_id" => $patient->id, "visit_date" => date('Y-m-d'), "server_status" => 'not', "user" => Auth::user()->firstname . " " . Auth::user()->middlename . " " . Auth::user()->lastname));
//adding address information
PatientInfo::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "hospital_id" => "somenumber", "region" => Input::get("region"), "district" => Input::get("district"), "ward" => Input::get("ward"), "ten_cell_leader" => Input::get("t_cell_leadr")));
//adding gynecological history inforamtion for a visit
GynecologicalHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "parity" => Input::get("parity"), "number_of_pregnancy" => Input::get("number_of_preg"), "menarche" => Input::get("menarche"), "age_at_sexual_debut" => Input::get("start_sex_age"), "marital_status" => Input::get("marital"), "age_at_first_marriage" => Input::get("first_marriage"), "sexual_partner" => Input::get("sexual_partner"), "partner_sexual_partner" => Input::get("partner_sexual_partner")));
//adding contraceptive history
ContraceptiveHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "current_status" => Input::get("current_on_contra"), "current_contraceptive_id" => Input::has("current_contra") ? Input::get("current_contra") : ""));
//adding HIV status
HivStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::has("hiv_status") ? Input::get("hiv_status") : "", "test_status" => Input::has("hiv_test_status") ? Input::get("hiv_test_status") : "", "unknown_reason" => Input::has("unknown_reason") ? Input::get("unknown_reason") : "", "years_since_first_diagnosis" => Input::has("year_since_diagnosis") ? Input::get("year_since_diagnosis") : "", "year_of_last_test" => Input::has("last_test") ? Input::get("last_test") : "", "art_status" => Input::has("art_status") ? Input::get("art_status") : "", "current_art_status" => Input::has("current_art_status") ? Input::get("current_art_status") : "", "pitc_offered" => Input::get("test_again") == "yes" ? "yes" : "no", "pitc_agreed" => Input::has("test_again") ? Input::get("test_again") : "", "pitc_result" => Input::has("current_test_result") ? Input::get("current_test_result") : "", "pitc_cd4_count" => Input::has("current_cd4") ? Input::get("current_cd4") : "", "prev_cd4_count" => Input::has("prev_cd4") ? Input::get("prev_cd4") : ""));
//adding VIA Status
ViaStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "via_counselling_status" => Input::get("via_counceling"), "via_test_status" => Input::get("via_test"), "reject_reason" => Input::has("via_reason") ? Input::get("via_reason") : "", "via_result" => Input::has("via_results") ? Input::get("via_results") : ""));
//adding colposcopy
ColposcopyStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("colposcopy_status"), "result_id" => Input::has("colpo_result") ? Input::get("colpo_result") : ""));
//adding Pap smear result
PapsmearStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("pap_status"), "result_id" => Input::has("pap_result") ? Input::get("pap_result") : ""));
//adding intervetion status
Intervention::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "type_id" => Input::has("intervention") ? Input::get("intervention") : "", "indicator_id" => Input::has("indicator") ? Input::get("indicator") : "", "histology_id" => Input::has("histology") ? Input::get("histology") : "", "cancer_id" => Input::has("cancer") ? Input::get("cancer") : "", "grade" => Input::has("hist_grade") ? Input::get("hist_grade") : "", "stages" => Input::has("stages") ? Input::get("stages") : "", "differentiation" => Input::has("differentiation") ? Input::get("differentiation") : ""));
$report = PatientReport::where('patient_id', $patient->id)->first();
$report->region = Input::get("region");
$report->district = Input::get("district");
$report->number_of_pregnancy = Input::get("number_of_preg");
$report->marital_status = Input::get("marital");
$report->first_marriage = Input::get("first_marriage");
$report->partners = Input::get("sexual_partner");
$report->partners_partner = Input::get("partner_sexual_partner");
$report->contraceptive_status = Input::get("current_on_contra");
$report->facility_id = Input::get("facility");
if (Input::has("current_contra")) {
$report->contraceptive_type = Input::get("current_contra");
}
if (Input::has("hiv_status")) {
$report->HIV_status = Input::get("hiv_status");
}
if (Input::has("current_cd4")) {
$report->cd4_count = Input::get("current_cd4");
} elseif (Input::has("prev_cd4")) {
$report->cd4_count = Input::has("prev_cd4");
}
$report->save();
if (Input::get("next_visit") != "") {
Notification::create(array("patient_id" => $patient->id, "message" => "Kumbuka Kwenda katika kituo ulichopimwa mara ya mwisho saratani ya shingo ya kizazi. Tafadhali fika bila kukosa tarehe " . Input::get('next_visit'), "status" => "pending", "phone_number" => $patient->phone, "next_visit" => Input::get('next_visit')));
}
Logs::create(array("user_id" => Auth::user()->id, "action" => "Patient followup for " . $patient->first_name . " " . $patient->last_name));
$msg = "Patient followup stored successfull";
return View::make('visit.index', compact('patient', "msg"));
}
示例8: notify
public function notify($app, $user_id)
{
if (!$app->user->isLoggedIn() || !$app->user->isRank('Support Technician')) {
$app->logger->log('Unauthorized access to Admin CP', 'ALERT', array(), 'admin');
$app->output->redirect('/');
}
try {
$user = User::find($user_id);
$request = $app->router->flight->request();
if ($request->method == 'POST') {
Notification::create(['user_id' => $app->user->id, 'receiver_id' => $user->id, 'title' => $request->data->title, 'body' => 'Message sent from [' . $app->user->name . '](http://steamcommunity.com/profile/' . $app->user->id . '):' . $request->data->body]);
$app->output->redirect('/admin/users');
} else {
$app->output->addBreadcrumb('admin', 'Dashboard');
$app->output->addBreadcrumb('admin/users', 'Manage Users');
$app->output->addBreadcrumb('admin/notify/' . $user_id, 'Notify User');
$app->output->setTitle('Notify User');
$app->output->setActiveTab('admin');
$app->output->render('admin.notify', ['user_to_notify' => $user]);
}
} catch (ActiveRecord\RecordNotFound $e) {
$app->logger->log('No such User found', 'ERROR', array('object' => 'User', 'id' => $user_id, 'pathway' => 'ban'), 'admin');
$app->output->notFound();
}
}
示例9: store
/**
* Store a newly created notification in storage.
*
* @return Response
*/
public function store()
{
// if( isset( $_POST['mandrill_events'] ) ){
// // NOTIFICAÇÃO DO MANDRILL
// $msg = array();
// $dados = @$_POST['mandrill_events'];
// $dados = json_decode($dados);
// // Mail Defaults
// $msg['from'] = 'contato@lucianotonet.com';
// $msg['from_name'] = 'L. Tonet';
// $msg['to'] = 'tonetlds@gmail.com';
// // SEND THE MAIL
// Mail::send('notifications.email', compact('dados'), function($message)use($msg){
// //$message->from('contato@lucianotonet.com', 'L. Tonet');
// //$message->from( $msg['from'], @$msg['from_name'] );
// $message->to( $msg['to'] );
// $message->subject('Notificação do Mandrill');
// });
// // NOTIFICATION
// $notification = new Notification;
// $notification->title = 'E-mail aberto';
// $dados = '<pre>'.$dados.'</pre>';
// $notification->message = $dados;
// $notification->save();
// return;
// }
$validator = Validator::make($data = Input::all(), Notification::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
// echo "<pre>";
// print_r($data);
// echo "</pre>";
// exit;
Notification::create($data);
// $alert = array(
// 'alert-success' => '<strong><i class="fa fa-check"></i></strong> Notificação criada!'
// );
$alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="fa fa-check"></i></strong> Notificação criada!'];
Session::flash('alerts', $alert);
return Redirect::to(URL::previous());
}
示例10: GroupUser
$group = Group::get_by_id($_GET['groupid']);
$object = new GroupUser();
$object->userid = $user->id;
$object->groupid = $group->id;
$object->level = 0;
$object->role = "student";
$object->enabled = 1;
$object->pending = 1;
$object->create();
$notification = new Notification();
$notification->fromuserid = $session->user_id;
$notification->touserid = $user->id;
$notification->itemid = $object->id;
$notification->itemtype = "groupuser";
$notification->title = "Invites you";
$notification->create();
$response = "success";
} else {
$theuser = GroupUser::getUser($user->id, $_GET['groupid']);
if ($theuser->pending == 0) {
$response = "This user is already a member.";
} else {
$response = "This user is already pending.";
}
}
}
}
}
}
}
$log = new Log($session->user_id, $clientip, "WEB", "INVITED: " . $user->id);
示例11:
<?php
namespace Kyoushu\DesktopNotifications;
require_once __DIR__ . '/vendor/autoload.php';
Notification::create('Test Message')->setExpireTime(15000)->send();
示例12: execJob
static function execJob($job, $opt)
{
if (isset($opt['n'])) {
echo "Dry-Run-Skip execJob: " . $job->id . ": " . $job->description . "\n";
return;
}
switch ($job->job_type) {
case Job::JOB_INTERACTIVE:
$job->job_status = Job::STATUS_RUNNING;
$job->last_started = time();
$job->save();
self::execAmtCommand($job, $opt);
$job->last_done = time();
$job->job_status = Job::STATUS_DONE;
$job->save();
// how to trigger increased monitoring until job completed?
if ($notification = Notification::create()) {
$notification->message = "Job {$job->id} completed";
$notification->ntype = "envelope";
$notification->user_id = 2;
// hardcoded spooler user
$notification->save();
}
break;
case Job::JOB_SCHEDULED:
$job->job_status = Job::STATUS_RUNNING;
$job->last_started = time();
$job->save();
self::execAmtCommand($job, $opt);
$job->last_done = time();
$job->job_status = Job::STATUS_PENDING;
$job->save();
if ($notification = Notification::create()) {
$notification->message = "{$job->description} completed";
// choose powerup-powerdown icons here! use execAmtCommand retval?
switch ($job->amtc_cmd) {
case 'U':
$notification->ntype = 'toggle-on';
break;
case 'D':
$notification->ntype = 'toggle-off';
break;
default:
$notification->ntype = 'envelope';
}
$notification->user_id = 2;
// hardcoded spooler user
$notification->save();
}
break;
case Job::JOB_MONITORING:
// find OUs that have monitoring enabled, join by optionset_id
self::execMonitoringJob($job, $opt);
break;
}
# sendNotification -> notification 'powered up x in y seconds'
}
示例13: store
/**
* Store a newly created tarefa in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Tarefa::$rules, Tarefa::$messages);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
// echo "<pre>";
// print_r( $data );
// echo "</pre>";
// exit;
$tarefa = Tarefa::create($data);
if ($tarefa) {
// ADICIONAR NOTIFICAÇÃO
if (!empty($data['notification']) and $data['notification'] > 0) {
$notificationDate = Carbon::createFromFormat('Y-m-d H:i:s', $data['date'])->subDays($data['notification']);
// CREATE NOTIFICACAO...
Notification::create(['date' => $notificationDate->format('Y-m-d'), 'icon' => 'fa-info-circle', 'title' => $data['notification-text'], 'owner_id' => $tarefa->id, 'owner_type' => 'tarefa']);
}
$alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="fa fa-check"></i></strong> Nova tarefa criada!'];
Session::flash('alerts', $alert);
return Redirect::back();
}
return Redirect::back()->withErrors($validator)->withInput(Input::all());
// if( !Input::get('id') ){
// }else{
// /**
// * MOVAR PARA UPDATE?
// * MARCA TAREFA COMO CONCLUÍDA OU NÃO
// * @var [type]
// */
// $id = Input::get('id');
// $tarefa = Tarefa::findOrFail($id);
// $tarefa->check();
// print_r($tarefa);
// return $tarefa;
// }
// return Redirect::route('tarefas.index');
}
示例14: notify
/**
* Create a notification for a user
*
* @param $user_id
* @param $notification_type
* @param $data
* @param $url
* @return static
*/
public function notify($user_id, $notification_type, $data, $url)
{
$notification = Notification::create(['user_id' => $user_id, 'notification_type' => $notification_type, 'data' => json_encode($data), 'url' => $url]);
return $notification;
}
示例15: invalid_trade_url
public function invalid_trade_url($app)
{
$request = $app->router->flight->request();
if ($request->method != 'POST') {
$this->error($app, 'Invalid entry');
}
$this->authorize($app, $request->data->key, $request->query->sig, $request->data);
$user_id = $request->data->user_id;
if (empty($user_id)) {
$this->error($app, 'Invalid user id');
}
try {
$user = User::find($user_id);
$notification = Notification::create(['user_id' => $user->id, 'receiver_id' => $user->id, 'title' => 'DENIAL', 'body' => '**A trade request could not be sent!**
We were unable to send you a trade offer -- ensure that your Steam trade URL is valid in your [settings](' . $app->config->get('core.url') . '/account/settings).']);
$app->output->json(array('error' => false, 'message' => 'Notification of invalid trade URL has been sent to user ' . $user->id . '.'));
} catch (ActiveRecord\RecordNotFound $e) {
$this->error($app, 'No such user found');
}
}