2018-01-01 04:00:45 +00:00
|
|
|
<?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)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
2018-01-01 08:32:20 +00:00
|
|
|
public function saving(Topic $topic)
|
|
|
|
{
|
|
|
|
$topic->excerpt = make_excerpt($topic->body);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:00:45 +00:00
|
|
|
public function updating(Topic $topic)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
}
|