for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Xetaravel\Observers;
use Illuminate\Support\Facades\Auth;
use Xetaravel\Models\Comment;
class CommentObserver
{
/**
* Handle the "creating" event.
*/
public function creating(Comment $comment): void
if (is_null($comment->user_id)) {
user_id
Xetaravel\Models\Comment
user
$comment->user_id = Auth::id();
}