laravel-learn-bbs/app/Observers/TopicObserver.php
2018-01-01 16:32:20 +08:00

26 lines
420 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->excerpt = make_excerpt($topic->body);
}
public function updating(Topic $topic)
{
//
}
}