/var/www/hkosl.com/imusiccircle/webadmin/models/Currency.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

use Illuminate\Database\Capsule\Manager as DB;
use 
Carbon\Carbon as Carbon;

class 
Currency extends BaseModel{
    protected 
$table "currency";

    public function 
currencyRates(){
        return 
$this->hasMany('CurrencyRate''currency_code''iso_code');
    }

    public static 
$platform;
    public static function 
platform(){
        if(
self::$platform){
            return 
self::$platform;
        }

        
// return Currency::where('iso_code', 'CNY')->first();
        // $temp = new self;
        
return self::$platform = new self(array(
            
'id' => 55,
            
'deleted' => 0,
            
'status' => 1,
            
'name_en' => 'Chinese yuan',
            
'name_tc' => 'Chinese yuan',
            
'name_sc' => 'Chinese yuan',
            
'name_idn' => 'Chinese yuan',
            
'symbol' => '¥',
            
'iso_code' => 'CNY',
            
'fractional_unit' => 'Fen',
            
'number_to_basic' => '100',
            
'precision' => '2',
        ));
    }

    public static 
$supplier;
    public static function 
supplier(){
        if(
self::$supplier){
            return 
self::$supplier;
        }

        return 
self::$supplier Supplier::find($_SESSION['supplier_id'])->currency;
    }
}