LoginSignup
3
3

More than 5 years have passed since last update.

Laravel5で便利クラス(Facade)使うときの儀式

Posted at

Laravel5でCrypt使いたかったんです。

これ見ると、
http://laravel.com/docs/5.0/encryption

$encrypted = Crypt::encrypt('secret');

ということなんで、やってみます。

ERROR: Class App\Http\Controllers\Crypt does not exist

使えない・・・
それにCryptはController下にないし。。。。

実は、Controllerの上部でincludeしてやる宣言が必要です。

use Illuminate\Support\Facades\Crypt;

これで使えるようになります。

config/app.phpのaliasesに記載してあるものは、基本全てこの宣言が必要ぽい。

use Crypt;

これでもいけます。

3
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3