close
非static參數使用方式為$this->參數名稱
ex: $this->aaa;
而static參數使用方式為self::$參數名稱
ex: self::$aaa;
--
That's because the Facade class only "redirects" method calls to the underlying class. So you can't access properties directly. The simplest solution is using a getter method.
class Facility
{
public static $MODEL_NOT_FOUND = '-1';
public function __construct() { ... }
public function getModelNotFound(){
return self::$MODEL_NOT_FOUND;
}
}
The alternative would be to write your own Facade class that extends from Illuminate\Support\Facades\Facade
and make use of magic methods to access properties directly
--
轉自 https://stackoverflow.com/questions/27347953/use-static-variables-in-laravel-facades
全站熱搜
留言列表