Hi, I want to build a Flarum extension and I need some Discussion data when DiscussionWillBeSaved
event fire.
My core code
public function myListenMethod(DiscussionWillBeSaved $event)
{
$client = $this->getClient();
$tag = $event->discussion->tags()->first(); // is this correct?
$post = $event->discussion->posts()->first(); // is this correct?
$client->createWork([
'name' => $event->discussion->title,
'datePublished' => $event->discussion->start_time,
'dateCreated' => $event->discussion->start_time,
'author' => $event->discussion->actor->username,
'tags' => $tag->name, // Can I access a tag name here ?
'content' => $post->content, // Can I access a Discussion content here ?
]);
}
Anyone can help?
Where can I find full docs about extension developing?
BTW,How to add a column to discussions table?