20 lines
352 B
PHP
20 lines
352 B
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Models\Post;
|
|
|
|
class PostObserver
|
|
{
|
|
/**
|
|
* Handle the Post "created" event.
|
|
*/
|
|
public function created(Post $post): void
|
|
{
|
|
// Register as Reactant when Post is created
|
|
if (!$post->isRegisteredAsLoveReactant()) {
|
|
$post->registerAsLoveReactant();
|
|
}
|
|
}
|
|
}
|