Initial commit
This commit is contained in:
19
app/Observers/PostObserver.php
Normal file
19
app/Observers/PostObserver.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user