This commit is contained in:
Aether
2025-09-25 10:46:45 +08:00
parent 3c89a01a81
commit db760bb276
4 changed files with 46 additions and 24 deletions

View File

@@ -119,9 +119,8 @@ abstract class AetherModel extends HyperfModel implements CacheableInterface
{
if (! static::query()->where('id', $id)->exists()) {
throw new ModelNotFoundException(sprintf(
'找不到ID为 %d 的 %s 记录',
'找不到 ID 为 %d 的记录',
$id,
static::class
));
}
return static::query()->where('id', $id)->delete() > 0;
@@ -155,9 +154,8 @@ abstract class AetherModel extends HyperfModel implements CacheableInterface
$record = static::query()->find($id);
if (is_null($record)) {
throw new ModelNotFoundException(sprintf(
'找不到ID为 %d 的 %s 记录',
$id,
static::class
'找不到 ID 为 %d 的记录',
$id
));
}
return $record; // static::query()->findOrFail($id);