Level 1
See this in the documentation https://laravel.com/docs/9.x/controllers#dependency-injection-and-controllers
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi Guys, I want to pass $conversationObj via on constructor. but i got this error . could you please help me to resolve this
Error
[2022-04-23 08:24:11] local.ERROR: Class name must be a valid object or a string {"exception":"[object] (Error(code: 0): Class name must be a valid object or a string at closure://function (\BotMan\BotMan\Messages\Incoming\Answer $answer) {
UserAuthenticateConversation.php
class UserAuthenticateConversation extends Conversation
{
private $conversationObj;
public function __construct($conversationObj)
{
$this->conversationObj = $conversationObj;
}
.....
public function askEmail()
{
$this->getBot()->startConversation($this->conversationObj);
}
DueInvoiceConversation.php
$dueInvoiceConversation = new DueInvoiceConversation();
return $this->getBot()->startConversation(new UserAuthenticateConversation($dueInvoiceConversation));
Please or to participate in this conversation.