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
 
 | 
<?php
  use Illuminate\Database\Capsule\Manager as DB; use Carbon\Carbon as Carbon;
  class Master_setting_model extends BaseModel{     protected $table = "master_setting";
      protected static $alldata = array();     protected static $init = false;
      protected static function init(){         self::all()->each(function($m){             Master_setting_model::$alldata[$m->attribute] = $m->val;         });         self::$init = true;     }
      public static function get($attribute=null){         if(!self::$init){             self::init();         }
          if($attribute){             return self::$alldata[$attribute];         }else{             return self::$alldata;         }     }
      public static function get_code($code){         return self::where('code', $code)->first();     } }
  
 |