再次优化
This commit is contained in:
@@ -60,9 +60,9 @@ abstract class AbstractModel extends AetherModel
|
||||
* @param array $columns
|
||||
* @return AbstractModel
|
||||
*/
|
||||
public static function findOrFail(int $id, $columns = []): self
|
||||
public static function findOrFail(mixed $id, $columns = []): self
|
||||
{
|
||||
$model = self::find($id);
|
||||
$model = self::find($id, $columns);
|
||||
if (!$model) {
|
||||
throw new ModelNotFoundException();
|
||||
}
|
||||
@@ -74,10 +74,7 @@ abstract class AbstractModel extends AetherModel
|
||||
*/
|
||||
public static function createOne(array $data): self
|
||||
{
|
||||
$model = new static();
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
return $model;
|
||||
return static::query()->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user