public function run()
 {
     DB::table('notifications')->delete();
     $collection = [['type_id' => 1, 'user_id' => 2, 'message' => 'New comment on selling with ADC'], ['type_id' => 3, 'user_id' => 2, 'message' => 'New message from George'], ['type_id' => 1, 'user_id' => 2, 'message' => 'New comment on selling with ADC', 'status' => 'complete'], ['type_id' => 4, 'user_id' => 2, 'message' => 'Watched auction closing'], ['type_id' => 5, 'user_id' => 2, 'message' => 'Watchlist inventory received.']];
     foreach ($collection as $record) {
         Notification::create($record);
     }
 }
 /**
  * Handle the command.
  *
  * @param  CreateNotificationCommand  $command
  * @return void
  */
 public function handle(CreateNotificationCommand $command)
 {
     $notification = Notification::create(['notified' => 0, 'alarm' => $command->alarm, 'shop_id' => $command->shop_id]);
     if (!empty($notification)) {
         return $notification;
     }
     return false;
 }
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Notification::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
 public function messageSent($request)
 {
     $this->userInfo = $request;
     $message_information = [];
     $message_information['message_from'] = session('active_user_id');
     $message_information['message_to'] = Users::where('email', '=', $this->userInfo->userInfo->input('message_to'))->pluck('id');
     $message_information['message'] = $this->userInfo->userInfo->input('message');
     DB::beginTransaction();
     Message::create($message_information);
     Notification::create(array('msg_from_user_id' => session('active_user_id')));
     DB::commit();
 }
Ejemplo n.º 5
0
 public function create($attributes)
 {
     if (!isset($attributes['txid'])) {
         throw new Exception("TXID is required", 1);
     }
     if (!isset($attributes['monitored_address_id']) and !isset($attributes['user_id'])) {
         throw new Exception("monitored_address_id or user_id is required", 1);
     }
     if (!isset($attributes['confirmations'])) {
         throw new Exception("confirmations is required", 1);
     }
     if (!isset($attributes['uuid'])) {
         $attributes['uuid'] = Uuid::uuid4()->toString();
     }
     if (!isset($attributes['status'])) {
         $attributes['status'] = 'new';
     }
     return Notification::create($attributes);
 }
Ejemplo n.º 6
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $now = Carbon::now();
     $model = Delivery::where('delivery_type_id', 2)->whereNull('datepublish')->whereBetween('datestart', [$now->subMinutes(2)->format('Y-m-d H:i:s'), $now->addMinute(3)->format('Y-m-d H:i:s')])->get();
     $data = $model->toArray();
     $driver = Driver::whereFlagactive(1)->get();
     Log::warning($now->format('Y-m-d H:i:s'));
     Log::warning($now->subMinutes(2)->format('Y-m-d H:i:s'));
     Log::warning($now->addMinute(3)->format('Y-m-d H:i:s'));
     Log::info('Cron funcionando');
     if (!empty($driver) && count($data) > 0) {
         foreach ($driver as $value) {
             foreach ($data as $objDelivery) {
                 Notification::create(array('type_id' => Notification::PUSH, 'platform_id' => Platform::ANDROID, 'user_id' => $value->id, 'app_id' => Config::get('app.APP_ID'), 'token' => \md5(\uniqid(\time())), 'description' => "{\"delivery_id\":\"{$objDelivery['id']}\",\"description\":\"Nuevo delivery\"}", 'appname' => Config::get('app.APP_NAME'), 'dbconfig' => Config::get('app.DB_CONFIG'), 'params' => "{\"delivery_id\":\"{$objDelivery['id']}\",\"description\":\"Nuevo delivery\"}", 'tosend' => $value->uuid, 'to' => 'Test', 'from' => 'Cligo', 'flagsend' => 0, 'flagactive' => 1));
                 $del = Delivery::find($objDelivery['id']);
                 $del->datepublish = Carbon::now()->format('Y-m-d H:i:s');
                 $del->save();
                 Log::info("Notificacion enviada del delivery id: {$objDelivery['id']}");
             }
         }
     }
 }
Ejemplo n.º 7
0
 public function requestStore(Request $req)
 {
     $values = ['sup_id' => $req->input('sup_id'), 'pb_no' => trim($req->input('pb_no')), 'pb_tgl_butuh' => $req->input('pb_tgl_butuh'), 'pb_note' => trim($req->input('pb_note')), 'visibility' => 1, 'userid_input' => Auth::user()->user_id];
     #pb_status, wether sudden-PO or not
     $values['pb_status'] = $req->input('create_po') == 1 ? 4 : 1;
     #End of sudden-PO
     $pb = Pb::create($values);
     #If sudden-PO then create PO head directly and a notification
     if ($req->input('create_po') == 1) {
         $get = Po::generateNumb('non');
         $values = ['pb_id' => $pb->pb_id, 'po_no' => generatePoNumb($get), 'po_tgl_buat' => now(), 'po_tgl_kedatangan' => $req->input('pb_tgl_butuh'), 'po_is_ppn' => 2, 'po_status' => 1, 'po_sudden' => 1];
         $po = Po::create($values);
         $values = ['gn_desc' => 'Pembuatan <i>Sudden-PO</i> oleh Rawmat dengan nomor PO: <strong>' . $po->po_no . '</strong>', 'gn_date' => now(true), 'gn_role' => 2, 'gn_read' => 2];
         Notif::create($values);
     }
     #Endif
     $x = 0;
     foreach ($_POST['mat_id'] as $val) {
         $values = ['pb_id' => $pb->pb_id, 'mat_id' => $val, 'pbs_jml' => $_POST['pbs_jml'][$x]];
         $pbs = Pbs::create($values);
         #If sudden-PO then create PO sub directly
         if ($req->input('create_po') == 1) {
             $values = ['po_id' => $po->po_id, 'pbs_id' => $pbs->pbs_id, 'pos_harga' => $_POST['mat_harga'][$x]];
             Po_sub::create($values);
         }
         #Endif
         $x++;
     }
     if ($req->input('create_po') == 1) {
         $message = 'Permintaan material telah dibuat berikut PO-nya dengan nomor: <strong>' . $po->po_no . '</strong>';
     } else {
         $message = 'Permintaan material telah dibuat.';
     }
     Session::flash('inserted', '<div class="info success">' . $message . '</div>');
     return redirect('material/request');
 }
Ejemplo n.º 8
0
 public static function notify(User $user, $title, $type = 'default', $subtitle = '')
 {
     $n = Notification::create(['user_id' => $user->id, 'title' => $title, 'subtitle' => $subtitle, 'type' => $type]);
     return $n;
 }
Ejemplo n.º 9
0
function notify($userId, $typeId, $message)
{
    $ins = ['type_id' => $typeId, 'user_id' => $userId, 'message' => $message];
    Notification::create($ins);
    return true;
}
 /**
  * Execute the job.
  *
  * @param Notification $notification
  * @return Collection
  */
 public function handle(Notification $notification)
 {
     $notification->create($this->request->toArray());
 }