お世話になってます。
今、サービスコンテナについて聞きたいことがあります。
それは下記コードにて、以下のようなエラーが出ます。
何が不味いのかわかりません。
お分かりの方、ご教示下さい。
<エラー名>
Undefined property: Illuminate\Routing\Router::$app
web.php
interface AnimalInterface{ public function cry(); } class DogClass implements AnimalInterface{ public function cry(){ return "bow-wow"; } } class CatClass implements AnimalInterface{ public function cry(){ return "neow"; } } $this->app->bind('onomatopoeia','CatClass');//ここでエラー Route::get('cry/',function(){ $onomato = $this->app->make('onomatopoeia'); return $onomato->cry(); });
お分かりの方、ご教示ください。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/08/03 01:24