protected static function boot() { parent::boot(); static::creating(function ($article) { if ($article['username'] == null) { $article['username'] = Auth::user()->username; } }); }