1

This is the code of model. I am unable to change access the function of conversation using the model method as i am passing data from view to botman conversation constructor through request.

    <?php
This is the conversation class
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Conversations\TestConversation;


class CheckSaved extends Model
{
    public function hasDate($scheduled_date):bool
    {
        if($scheduled_date)
        {
        $testconv = new TestConversation($scheduled_date);
        $testconv->showOther();
    
        }
        return false;
    }
}][1]


    <?php 

namespace App\Conversations;
use BotMan\BotMan\Messages\Incoming\Answer;
use BotMan\BotMan\Messages\Conversations\Conversation;
use App\Http\Traits\PropertyDetails;
use App\Models\CheckSaved;



class TestConversation extends Conversation
{
    public $is_saved;
    public function __construct($request)
    {    
        if(isset($request->scheduled_date))
        {
            $checkDate = new CheckSaved();
            $this->is_saved = $checkDate->hasDate($request->scheduled_date);
        } 
    }

    public function sayHi() 
    {
        // dd($request);
        $this->say("<input type='datetime-local' id='birthdaytime' name='birthdaytime'>");
        $this->say("<button class='btn-date' onclick='test()'>Save</button>");
    }

    public function showOther()
    {
        $this->say('Hi');
    }
    public function run()
    {
        $this->sayHi();
    }
}

This is the image of Model

I am getting reply() on null if try to call a function called "showOther()" inside TestConversation. I am stuck on it please someone help or contact me.

  • Stacktrace looks like this: { "message": "Call to a member function reply() on null", "exception": "Error", "file": "E:\\Php-Laravel-Projects\\botmantest\\vendor\\botman\\botman\\src\\Messages\\Conversations\\Conversation.php", "line": 205, "trace": [ { "file": "E:\\Php-Laravel-Projects\\botmantest\\app\\Conversations\\TestConversation.php", "line": 36, "function": "say", "class": "BotMan\\BotMan\\Messages\\Conversations\\Conversation", "type": "->" }, – Zeeshan Haider Jun 06 '22 at 10:43

0 Answers0