mirror of
https://github.com/flarum/core.git
synced 2025-10-13 16:05:05 +02:00
@@ -22,10 +22,12 @@ use Flarum\Event\DiscussionWasRestored;
|
||||
use Flarum\Event\DiscussionWasStarted;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Flarum\Event\ScopePostVisibility;
|
||||
use Flarum\Util\Str;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $title
|
||||
* @property string $slug
|
||||
* @property int $comments_count
|
||||
* @property int $participants_count
|
||||
* @property int $number_index
|
||||
@@ -432,4 +434,17 @@ class Discussion extends AbstractModel
|
||||
{
|
||||
static::$stateUser = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the discussion title.
|
||||
*
|
||||
* This automatically creates a matching slug for the discussion.
|
||||
*
|
||||
* @param string $title
|
||||
*/
|
||||
protected function setTitleAttribute($title)
|
||||
{
|
||||
$this->attributes['title'] = $title;
|
||||
$this->slug = Str::slug($title);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user