Sep 13, 2020
0
Level 13
IoC not auto resolving Too few argument...
web.php
$router->get('/updates',
[
'uses' => 'TelegramController@updates',
]
);
TelegramController.php
protected Api $tg;
public function __construct(Api $tg)
{
$this->tg = $tg;
}
AppServiceProvider.php
$this->app
->when(TelegramController::class)
->needs(Api::class)
->give(function () {
return new Api('TOKEN');
});
When i hit the route :
Too few arguments to function App\Http\Controllers\TelegramController::__construct()
What i'm missing here?
Please or to participate in this conversation.