Skip to content

9.2 Notification Function

Taufik Firmansyah edited this page Nov 26, 2015 · 3 revisions

In New Sximo 5.1.2 we adding notification system .

// filename /app/Library/SximoHelpers.php
  static function storeNote( $args )
  {
      $args =  array_merge( array(
        'url'       => '#' ,
        'userid'    => '0' ,
        'title'     => '' ,
        'note'      => '' ,
        'created'   => date("Y-m-d H:i:s") ,
        'icon'      => 'fa fa-envelope',
        'is_read'   => 0   
        ), $args ); 

       
        \DB::table('tb_notification')->insert($args);   
  }

##How to adding notification to spesific users ?##

Example after save data , you want to notify superadmin that new data is changed

	function postSave( Request $request)
	{
		
		$notif = array(
			'url'	=> '#',
			'userid'	=> '1',
			'title'		=> 'New data changed',
			'note'		=> 'Hi Admin, some data has been changed',

		);
		\SximoHelpers::storeNote($notif);
	
	}	

if you log as superadmin with user id 1 , this notification will appeared at your top right screen

Clone this wiki locally