You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature as you'd like to see it
It appears documentation for Mixins under masoniteorm.scope is not yet written. Add best practice commonly used Mixins to documentation. Orator Orm provides a great example on this. https://orator-orm.com/docs/0.9/orm.html#soft-deleting
What do we currently have to do now?
Confirm a best practice model for SoftDeletesMixin, Timestamps... any others?
Additional context
Not a best practice model, but something to work off of to showcase capabilities.
"""Investigator Model."""
from masoniteorm.relationships import belongs_to
from masoniteorm.models import Model
from masoniteorm.scopes import scope, SoftDeletesMixin, TimeStampsMixin
class Investigator(Model, SoftDeletesMixin, TimeStampsMixin):
""" Investigator model with parent-child hierarchy. """
__guarded__ = [] # Pass-through, only for internal use, public-facing security implications
__table__ = 'Investigators' # not required, smart table association
__timestamps__ = ['created_at', 'updated_at', 'deleted_at'] # includes deleted_at for Soft Deletions
@belongs_to('id', 'id_base')
def base(self):
return Case
@belongs_to('id', 'id_parent')
def parent(self):
return Case
@belongs_to('id_ticketholder_org', 'id')
def ticketholder(self):
from app.models.Org import Org
return Org
@belongs_to('id_originator_org', 'id')
def originator(self):
from app.models.Org import Org
return Org
@belongs_to('id_platform', 'id')
def platform(self):
from app.models.Platform import Platform
return Platform
@belongs_to('id_status', 'id')
def case_status(self):
from app.models.CaseStatus import CaseStatus
return CaseStatus
@belongs_to('id_case_type', 'id')
def case_type(self):
from app.models.CaseType import CaseType
return CaseType
@scope
def active(self, query):
return query.where('active', 1)
@scope
def is_initialized(self, query):
return query.where('is_initialized', 1)
@scope
def previously_seen(self, query):
return query.where('previously_seen', 1)
@scope
def initial_data(self, query):
return query.where('initial_data', 1)
@scope
def active(self, query, active_or_inactive):
return query.where('active', active_or_inactive)
@scope
def max_winnables(self, query, max_winnables):
return query.where_winnables(max_winnables)
Describe the feature as you'd like to see it
It appears documentation for Mixins under masoniteorm.scope is not yet written. Add best practice commonly used Mixins to documentation. Orator Orm provides a great example on this. https://orator-orm.com/docs/0.9/orm.html#soft-deleting
What do we currently have to do now?
Confirm a best practice model for SoftDeletesMixin, Timestamps... any others?
Additional context
Not a best practice model, but something to work off of to showcase capabilities.
Is this a breaking change?
No
What process is followed in order to contribute?
https://github.com/MasoniteFramework/orm/blob/1.0/CONTRIBUTING.md#issues
Would you like to contribute?
Yes
The text was updated successfully, but these errors were encountered: