避免使用静态访问课程' ...'在方法' ...'

时间:2017-05-12 14:48:37

标签: php laravel

我是laravel app并决定添加phpmd

User模型中的示例代码

   use Illuminate\Support\Facades\Hash;

   ...

   public function setPasswordAttribute($value)
     {   
         $this->attributes['password'] = Hash::make($value);
     } 

phpmd显示错误

Avoid using static access to class '\Illuminate\Support\Facades\Hash' in method 'setPasswordAttribute'.

如何处理此类错误?

0 个答案:

没有答案