Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/vhost/ats.isankalpa.org/app/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhost/ats.isankalpa.org/app/UserModel.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class UserModel extends Model
{

	private $menu_table, $menu_permit_table, $users_table, $user_type_table;


	public function __construct()
   {
      $this->menu_table         = config( 'app.CUSTOM_CONFIG.DB_TABLES.MENU_TABLE' );
      $this->menu_permit_table  = config( 'app.CUSTOM_CONFIG.DB_TABLES.MENU_PERMIT_TABLE' );
      $this->users_table        = config( 'app.CUSTOM_CONFIG.DB_TABLES.USERS_TABLE' );
      $this->user_type_table    = config( 'app.CUSTOM_CONFIG.DB_TABLES.USER_TYPE_TABLE' );
      $this->user_log_table     = config( 'app.CUSTOM_CONFIG.DB_TABLES.WIRS_USER_LOG' );
	  $this->location_table     = config( 'app.CUSTOM_CONFIG.DB_TABLES.LOCATIONS_MASTER_TABLE' );
	  $this->tbl_designation	= config( 'app.CUSTOM_CONFIG.DB_TABLES.DESIGNATION_MASTER_TABLE' );
      $this->tbl_department 	= config( 'app.CUSTOM_CONFIG.DB_TABLES.DEPARTMENT_MASTER_TABLE' );
	  $this->tbl_leave_configuration	= config( 'app.CUSTOM_CONFIG.DB_TABLES.LEAVES_CONFIGURATION_TABLE' );
      $this->tbl_leave_detaiils 	= config( 'app.CUSTOM_CONFIG.DB_TABLES.LEAVES_DETAILS_TABLE' );
	  $this->tbl_leave_master 	= config( 'app.CUSTOM_CONFIG.DB_TABLES.LEAVES_MASTER_TABLE' );
   }



	public function get_all_user_type_drop_down_data(  )
	{
		//$where  = 1;
		//$where = "i_id !=1 AND i_is_deleted = '0' AND i_is_active = '1' ";

		/*if( $active_only )
			$where .= " AND i_is_active = '1' ";
		if( $not_deleted )
			$where .= " AND i_is_deleted = '0' ";
		if( $not_admin )
			$where .= " AND i_id != 1 ";*/

		/*$sql = "SELECT i_id, s_type_name FROM {$this->user_type_table} WHERE ".$where;
		$results = DB::select($sql);

		if( count( $results ) > 0 )
		{
			if( is_array( $results ) )
				return $results;
			else
				return $results->toArray();
		}
		else
			return [];*/

		$where = "i_is_active = '1' AND i_id !=1 AND i_is_deleted = '0'";
		$sql = "SELECT * FROM {$this->user_type_table} WHERE ".$where;
			$results = DB::select($sql);
	
			if( count( $results ) > 0 )
			{
				if( is_array( $results ) )
					return $results;
				else
					return $results->toArray();
			}
			else
				return [];
	}

	public function get_all_location( $active_only = true, $not_admin = true )
	{
		$where  = 1;

		if( $active_only )
			$where .= " AND i_is_active = '1' ";
		
		if( $not_admin )
			$where .= " AND i_id != 1 ";

		$sql = "SELECT * FROM {$this->location_table} WHERE ".$where;
		$results = DB::select($sql);

		if( count( $results ) > 0 )
		{
			if( is_array( $results ) )
				return $results;
			else
				return $results->toArray();
		}
		else
			return [];
	}

	public function get_all_location_by_id($active_only = true) {
		$query = DB::table($this->location_table)->whereRaw("1"); // Use where instead of whereRaw for array conditions
	
		if ($active_only) {
			$query->where("{$this->location_table}.i_is_active", '1');
		}
	
		
		$results = $query->get();
	
		return $results->toArray();
		
	}
	

	public function get_all_user_data( $active_only = true, $not_admin = true )
	{
		$where  = "i_is_active = '1' AND i_id != '1'";

		/*if( $active_only )
			$where .= " AND i_is_active = '1' ";
		
		if( $not_admin )
			$where .= " AND i_id != '1' ";

			$sql = "SELECT * FROM `users` WHERE i_is_active = '1' AND i_id != '1'";

            $results = DB::select($sql);*/
        // Remove the current authenticated user from the result set

		$sql = "SELECT * FROM {$this->users_table} WHERE ".$where;
		$results = DB::select($sql);

		if( count( $results ) > 0 )
		{
			if( is_array( $results ) )
				return $results;
			else
				return $results->toArray();
		}
		else
			return [];
	}

	


	public function save_user_data( $user_data = [] )
	{
		if( !empty( $user_data ) )
		{
			//$user = new User();

			// foreach( $user_data as $index => $data )
			// {
			// 	$user[$index] = $data;
			// }
      		//$user->save();
      		//$user_id =  $user->i_id;

      		$user_id = DB::table($this->users_table)->insertGetId( $user_data );

      		//DB::update('update '.$this->users_table.' set id = ? where i_id = ?',[$user_id,$user_id]);

      		return $user_id;
		}

		return false;
	}

	public function get_user_data( $id = 0 )
	{
		if( $id > 0 )
		{
			$cond[] = ['i_id', '=', $id];
			$results =DB::table( $this->users_table )->select( '*' )->where( $cond )->get();

			if( count( $results ) > 0 )
			{
				if( is_array( $results ) )
					return $results;
				else
					return $results->toArray()[0];
			}
		}
		return [];
	}


	public function update_user_data( $id = 0, $user_data = [] )
	{
		if( $id && !empty( $user_data ) )
		{
			$results = DB::table( $this->users_table )
                     ->where( ['i_id'=>$id] )
                     ->update( $user_data );

		    return $results;
		}
		return false;
	}


	public function save_user_type_data( $user_type_data = [] )
	{
		if( !empty( $user_type_data ) )
		{			
      		$user_type_id = DB::table( $this->user_type_table )->insertGetId( $user_type_data );

      		return $user_type_id;
		}

		return false;
	}


	public function get_user_type_data( $id = 0 )
	{
		if( $id > 0 )
		{
			$cond[] = ['i_id', '=', $id];
			$results =DB::table( $this->user_type_table )->select( '*' )->where( $cond )->get();

			if( count( $results ) > 0 )
			{
				if( is_array( $results ) )
					return $results;
				else
					return $results->toArray()[0];
			}
		}
		return [];
	}


	public function update_user_type_data( $id = 0, $user_type_data = [] )
	{
		if( $id && !empty( $user_type_data ) )
		{
			$results = DB::table( $this->user_type_table )
                     ->where( ['i_id'=>$id] )
                     ->update( $user_type_data );

		    return $results;
		}
		return fasle;
	}



	// public function get_where_raw( $sql = '' )
	// {
	// 	if( $sql )
	// 	{
	// 		$results = DB::select($sql);

	// 		if( count( $results ) > 0 )
	// 		{
	// 			if( is_array( $results ) )
	// 				return $results;
	// 			else
	// 				return $results->toArray();
	// 		}
	// 	}
	// 	return [];
	// }


	// public function insert_where_raw( $sql = '' )
	// {
	// 	if( $sql )
	// 	{
	// 		$results = DB::insert($sql);

	// 		if( $results->count() > 0 )
	// 		{
	// 			if( is_array( $results ) )
	// 				return $results;
	// 			else
	// 				return $results->toArray();
	// 		}
	// 	}
	// 	return [];
	// }


	// public function update_where_raw( $sql = '' )
	// {
	// 	if( $sql )
	// 	{
	// 		$results = DB::update($sql);

	// 		if( $results->count() > 0 )
	// 		{
	// 			if( is_array( $results ) )
	// 				return $results;
	// 			else
	// 				return $results->toArray();
	// 		}
	// 	}
	// 	return [];
	// }


	// public function delete_where_raw( $sql = '' )
	// {
	// 	if( $sql )
	// 	{
	// 		$results = DB::delete($sql);

	// 		if( $results->count() > 0 )
	// 		{
	// 			if( is_array( $results ) )
	// 				return $results;
	// 			else
	// 				return $results->toArray();
	// 		}
	// 	}
	// 	return [];
	// }


public function save_log_data( $user_data = [] )
	{
		if( !empty( $user_data ) )
		{

      		$user_id = DB::table($this->user_log_table)->insertGetId( $user_data );

     		return $user_id;
		}

		return false;
	}

	public function get_all_designation()
	{
		$where = "i_is_active = '1'";
		$sql = "SELECT * FROM {$this->tbl_designation} WHERE ".$where;
		$results = DB::select($sql);

		if( count( $results ) > 0 )
		{
			if( is_array( $results ) )
				return $results;
			else
				return $results->toArray();
		}
		else
			return [];
	}

	public function get_all_department()
	{
		$where = "i_is_active = '1'";
		$sql = "SELECT * FROM {$this->tbl_department} WHERE ".$where;
		$results = DB::select($sql);

		if( count( $results ) > 0 )
		{
			if( is_array( $results ) )
				return $results;
			else
				return $results->toArray();
		}
		else
			return [];
	}

	public function get_all_department_by_id($active_only = true) {

		$where = "i_is_active = '1' ";

		$sql = "SELECT * FROM {$this->tbl_department} WHERE ".$where;
		$results = DB::select($sql);

		if( count( $results ) > 0 )
		{
			if( is_array( $results ) )
				return $results;
			else
				return $results->toArray();
		}
		else
			return [];
		
	}

	public function get_all_designation_by_id($active_only = true) {
		$where = "i_is_active = '1' ";

		$sql = "SELECT * FROM {$this->tbl_designation} WHERE ".$where;
		$results = DB::select($sql);

		if( count( $results ) > 0 )
		{
			if( is_array( $results ) )
				return $results;
			else
				return $results->toArray();
		}
		else
			return [];
		
	}



}

Youez - 2016 - github.com/yon3zu
LinuXploit