Пример #1
0
 /**
  * Mark Read Announcement
  *
  * @since 0.1
  *
  * @return json|boolean
  */
 public function mark_read_announcement()
 {
     $this->verify_nonce('wp-erp-hr-nonce');
     $row_id = intval($_POST['id']);
     \WeDevs\ERP\HRM\Models\Announcement::find($row_id)->update(['status' => 'read']);
     return $this->send_success();
 }
Пример #2
0
/**
 * Get Employee Announcement List
 *
 * @since 0.1
 *
 * @param  integer $user_id
 *
 * @return array
 */
function erp_hr_employee_dashboard_announcement($user_id)
{
    global $wpdb;
    return erp_array_to_object(\WeDevs\ERP\HRM\Models\Announcement::join($wpdb->posts, 'post_id', '=', $wpdb->posts . '.ID')->where('user_id', '=', $user_id)->orderby($wpdb->posts . '.post_date', 'desc')->take(8)->get()->toArray());
}
Пример #3
0
 /**
  * Get assign Employee
  *
  * @since  0.1
  *
  * @param  integer $post_id
  *
  * @return array
  */
 function get_assign_employee($post_id)
 {
     $results = \WeDevs\ERP\HRM\Models\Announcement::select(['user_id'])->where(['post_id' => $post_id])->get()->toArray();
     if ($results) {
         return $results;
     } else {
         return array();
     }
 }