https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/laciasmara.com/public_html/shop/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/laciasmara.com/public_html/shop/application/models/Vendors_m.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Vendors_m extends MY_Model
{

    protected $_table_name = 'vendors';
    protected $_primary_key = 'id_vendor';
    protected $_order_by = 'id_vendor';

    public $rules = array(

        array(
            'field'   => 'vendor_name',
            'label'   => 'Nama Vendor',
            'rules'   => 'trim|required'
        ),
        array(
            'field'   => 'vendor_email',
            'label'   => 'Email Vendor',
            'rules'   => 'trim|required|valid_email'
        ),
        array(
            'field'   => 'vendor_alamat',
            'label'   => 'Alamat Vendor',
            'rules'   => 'trim|required'
        ),
    );

    function __construct()
    {
        parent::__construct();
    }

    //pagination included
    function get_all_vendors()
    {
        $this->db->select('*');
        $this->db->from('vendors');
        $this->db->order_by('id_vendor');
        $query = $this->db->get();
        return $query->result();
    }

    function getNewVendor($b = null, $c = null, $d = null, $a = null)
    {
        $vendors = new stdClass();
        $vendors->id_vendor = $a;
        $vendors->vendor = $b;
        $vendors->email = $c;
        $vendors->alamat = $d;
        return $vendors;
    }

    function getEditVendor($id)
    {
        $this->db->select('*');
        $this->db->from('vendors');
        $this->db->where('id_vendor', $id);
        $query = $this->db->get();
        $result = $query->result();
        foreach ($result as $row) return $row;
    }

    function addVendor($vendor, $email, $alamat)
    {
        $data = array(
            'vendor' => $vendor,
            'email' => $email,
            'alamat' => $alamat,
        );

        $this->db->insert('vendors', $data);
        //logging
        $user_id = $this->session->userdata('admin')['id'];

        $activity = 'User menambah vendor (' .  $data['vendor'] . ')';

        log_activity($user_id, $activity);
    }

    function editVendor($id, $vendor, $email, $alamat)
    {
        $array = array(
            'vendor' => $vendor,
            'email' => $email,
            'alamat' => $alamat
        );

        $this->db->set($array);
        $this->db->where('id_vendor', $id);
        $this->db->update('vendors');

        //logging
        $user_id = $this->session->userdata('admin')['id'];

        $activity = 'User mengedit vendor (' .  $array['vendor'] . ')';

        log_activity($user_id, $activity);
    }
}

https://t.me/RX1948 - 2025