auth_guard ?? config('auth.defaults.guard'); if (! Auth::guard($authGuard) instanceof StatefulGuard) { throw new StatefulGuardRequiredException($authGuard); } $model->created_at = $model->created_at ?? $model->freshTimestamp(); $model->token = $model->token ?? Str::random(128); $model->auth_guard = $authGuard; }); } }