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\BlogArticle;
class ArticleObserver
{
/**
* Handle the "creating" event.
*/
public function creating(BlogArticle $article): void
if (is_null($article->user_id)) {
is_null($article->user_id)
false
$article->user_id = Auth::id();
}
* Handle the "updating" event.
public function updating(BlogArticle $article): void
$article->generateSlug();