27 lines
483 B
PHP
27 lines
483 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Models\Topic;
|
|
|
|
// creating, created, updating, updated, saving,
|
|
// saved, deleting, deleted, restoring, restored
|
|
|
|
class TopicObserver
|
|
{
|
|
public function creating(Topic $topic)
|
|
{
|
|
//
|
|
}
|
|
|
|
public function saving(Topic $topic)
|
|
{
|
|
$topic->body = clean($topic->body, 'user_topic_body');
|
|
$topic->excerpt = make_excerpt($topic->body);
|
|
}
|
|
|
|
public function updating(Topic $topic)
|
|
{
|
|
//
|
|
}
|
|
} |