Discount
class Discount extends BaseModel (View source)
Traits
Properties
protected | $guarded | ||
protected array | $casts | Define which attributes should be cast. |
|
int | $id | ||
string | $name | ||
string | $handle | ||
?string | $coupon | ||
string | $type | ||
Carbon | $starts_at | ||
Carbon | $ends_at | ||
int | $uses | ||
?int | $max_uses | ||
int | $priority | ||
bool | $stop | ||
Carbon | $created_at | ||
Carbon | $updated_at |
Methods
Get new instance of the registered model.
Handle dynamic and static method calls into the model.
Forward a method call to the model only when calling a method on the model.
Register a model event with the dispatcher.
Fire the given event for the model.
Remove all the event listeners for the model.
Translate a given attribute based on passed locale.
Translate a value from attribute data.
Apply the channel scope to the query
Return whether or not the models provided are suitable for scheduling.
Unschedule models for a relation.
Return the customer groups relationship.
Schedule models against customer groups.
Unschedule models against a customer group.
Apply customer group scope.
Apply the customer group scope
Return a new factory instance for the model.
No description
Return the purchasables relationship.
No description
No description
No description
No description
Return the collections relationship.
No description
Return the active scope.
Return the products scope.
No description
Details
Model
newInstance(array $attributes = [], bool $exists = false)
Get new instance of the registered model.
mixed
__call(string $method, array $parameters)
Handle dynamic and static method calls into the model.
Model
swap(string $newModelClass)
Swap the model implementation.
string
getMorphClass()
Get the class name of the base model.
protected bool
forwardCallsWhen(string $method, Model $model)
Forward a method call to the model only when calling a method on the model.
static protected void
registerModelEvent(string $event, QueuedClosure|Closure|string $callback)
Register a model event with the dispatcher.
protected mixed
fireModelEvent(string $event, bool $halt = true)
Fire the given event for the model.
static void
flushEventListeners()
Remove all the event listeners for the model.
__construct(array $attributes = [])
Create a new instance of the Model.
string
translate(string $attribute, string $locale = null)
Translate a given attribute based on passed locale.
string
translateAttribute(string $attribute, string $locale = null)
Translate a value from attribute data.
void
attr(...$params)
Shorthand to translate an attribute.
static
bootHasChannels()
No description
Channel>
channels()
Get all of the models channels.
MorphToMany
activeChannels()
Return the active channels relationship.
Builder
scopeChannel(Builder $query, Channel|iterable $channel = null, DateTime $startsAt = null, DateTime $endsAt = null)
Apply the channel scope to the query
abstract protected void
validateScheduling(Collection $models)
Return whether or not the models provided are suitable for scheduling.
protected void
schedule(Relation $relation, mixed $models, DateTime $starts = null, DateTime $ends = null, array $pivotData = [])
Schedule models for a given relation.
protected void
unschedule(Relation $relation, mixed $models, array $pivotData = [])
Unschedule models for a relation.
BelongsToMany
customerGroups()
Return the customer groups relationship.
void
scheduleCustomerGroup(mixed $models, DateTime $starts = null, DateTime $ends = null, array $pivotData = [])
Schedule models against customer groups.
void
unscheduleCustomerGroup(mixed $models, array $pivotData = [])
Unschedule models against a customer group.
Builder
applyCustomerGroupScope(Builder $query, Collection $groupIds, DateTime $startsAt, DateTime $endsAt)
Apply customer group scope.
Builder
scopeCustomerGroup(Builder $query, CustomerGroup|iterable $customerGroup = null, DateTime $startsAt = null, DateTime $endsAt = null)
Apply the customer group scope
static protected DiscountFactory
newFactory()
Return a new factory instance for the model.
users()
No description
HasMany
purchasables()
Return the purchasables relationship.
purchasableConditions()
No description
purchasableLimitations()
No description
purchasableRewards()
No description
getType()
No description
HasMany
collections()
Return the collections relationship.
brands()
No description
Builder
scopeActive(Builder $query)
Return the active scope.
Builder
scopeProducts(Builder $query, iterable $productIds = [], string $type = null)
Return the products scope.
scopeUsable(Builder $query)
No description