I have issue with userStorage.
I have two facebook account.
When I write from my first facebook account to messenger, the user selects a city from Generic Themplate. It writes this response to userStorage. But when I write from the second account and choose city, userStorage displays the answer from the first. How can I fix it.
@s4rrow can you post a code of your conversations?
Save to UserStorage - botman.php
$botman->hears('Bia艂ogard', function($bot)
{
$miasto = 'bialogard';
$bot->userStorage()->save([
'miasto' => $miasto
]);
$bot->startConversation(new UpdateBazyKlub());
});
Add to database from user storage - UpdateBazyKlub
$userStorage = $this->bot->userStorage()->all();
$miasto = $userStorage[0]->get('miasto');
User::Test($this->bot->getUser(), $miasto);
User::Test
{
User::updateOrCreate([
'fb_id' => $user->getId()], [
'klub' => $miasto,
]);
}
And next step i show general menu.
public function menu()
{
$userStorage = $this->bot->userStorage()->all();
$miasto = $userStorage[0]->get('miasto');
i use $miasto variable to build link
$this->bot->reply(GenericTemplate::create()
->addElements([
Element::create('Oferta')
->subtitle('Sprawd藕 ofert臋 klub贸w Xtreme Fitness Gyms')
->image('https://website.com/tlo1.jpg')
->addButton(ElementButton::create('馃憠 Oferta')
->url('https://www.website.pl/'.$miasto.'/price'))
@s4rrow can you post a code of your conversations?
@s4rrow where do you see that example of use
//...
$miasto = $userStorage[0]->get('miasto');
//...
i think you dont need to insert data directly inside botman Storage
that looks like sample data collections inside Laravel
p.s. you need to read Read from storage
@s4rrow where do you see that example of use
//... $miasto = $userStorage[0]->get('miasto'); //...i think you dont need to insert data directly inside botman Storage
that looks like sample data collections inside Laravelp.s. you need to read _Read from storage_
Thanks, my fault.
i change:
```
$userStorage = $this->bot->userStorage()->all();
$miasto = $userStorage[0]->get('miasto');
$userStorage = $this->bot->userStorage()->find();
$miasto = $userStorage ->get('miasto');
```
And works. I close topic!
Good For you!)
Most helpful comment
@s4rrow where do you see that example of use
i think you dont need to insert data directly inside botman Storage
that looks like sample data collections inside Laravel
p.s. you need to read Read from storage