問題タブ [laravel-facade]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
2 に答える
1339 参照

php - PHPUnit Laravel ハッシュが利用できない

このような API 呼び出しをテストするために Laravel で単体テストを行っていますが、実行時に次のランタイム エラーが発生します。

setup メソッドでユーザーを作成し、tearDown() メソッドで再度削除してから、認証テストを実行します。

まず、私がやりたいことを行うためのより良い方法はありますか? たとえば、データベースに触れずにユーザーを嘲笑しますか? 次に、「ファサードルート」を設定するにはどうすればよいですか、またはそのエラーは正確には何を意味しますか? ダミーユーザーを作成する目的でその特定のフィールドをハッシュすることを気にしないようにしましたが、エラーはモデルに移動するようで、(再び) Hash ファサードクラスが使用されます。

これらのファサードをテストで使用できるように、環境をセットアップするための追加の手順はありますか?

前もって感謝します。

0 投票する
1 に答える
68 参照

php - Laravel 5.3 で Facade を作成する際のエラー

laravelでファサードを作成しようとしています。

私のファサード:

私の基本クラス:

呼び出し中 :

次のようなエラーが発生しました:

これの何が問題なのですか?

助言がありますか ?

0 投票する
3 に答える
21220 参照

php - What is Facades used in Laravel?

I'm confused by the Facades offered by Laravel.

The Laravel documentation states:

Facades provide a "static" interface to classes that are available in the application's service container. Laravel ships with many facades which provide access to almost all of Laravel's features. Laravel facades serve as "static proxies" to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.

Please help me to understand:

  1. Why we really use use Illuminate\Support\Facades?
  2. How to create custom Facades ?