Skip to content

Commit 00c8cb4

Browse files
committed
added fresh to models
1 parent 11061de commit 00c8cb4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/masoniteorm/models/Model.py

+7
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ def create(cls, dictionary=None, query=False, **kwargs):
365365

366366
return cls.builder.create(dictionary)
367367

368+
def fresh(self):
369+
return (
370+
self.get_builder()
371+
.where(self.get_primary_key(), self.get_primary_key_value())
372+
.first()
373+
)
374+
368375
def serialize(self):
369376
"""Takes the data as a model and converts it into a dictionary.
370377

0 commit comments

Comments
 (0)