table()); if (! $includeDeleted && $this->hasDeletedAtColumn()) { $query->whereNull('deleted_at'); } return $query; } protected function insert(array $attributes): bool { $now = Carbon::now(); return DB::table($this->table())->insert(array_merge([ 'created_at' => $now, 'updated_at' => $now, ], $attributes)); } protected function hasDeletedAtColumn(): bool { static $cache = []; return $cache[$this->table()] ??= DB::getSchemaBuilder()->hasColumn($this->table(), 'deleted_at'); } }