mphpmaster/laravel-nova-date-field

Laravel Nova Date Field

2.0.0 2023-04-01 05:15 UTC

This package is auto-updated.

Last update: 2024-11-30 01:54:06 UTC


README

Extending Laravel\Nova\Fields\Date adding helpers methods.

Installation

composer require mphpmaster/laravel-nova-date-field

Usage

public function fields(Request $request)
{
    return [
        Date::make('start_date')->addRuleBeforeOrEqual('end_date');
        Date::make('end_date')->addRuleAfterOrEqual('start_date');
    ];
}

Date Field Methods And Arguments:

Method addRuleAfter:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method addRuleAfterOrEqual:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method addRuleBefore:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method addRuleBeforeOrEqual:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method setRuleAfter:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method setRuleAfterOrEqual:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method setRuleBefore:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method setRuleBeforeOrEqual:

  • $attributeOrValue: Model attribute, or any date like today() or 01-01-2023.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method afterToday:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method afterYesterday:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method afterOrEqualToday:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method afterOrEqualYesterday:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method beforeToday:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method beforeTomorrow:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method beforeOrEqualToday:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Method beforeOrEqualTomorrow:

  • $append_rules = true: To append or override existing rules.
  • $is_creation = false: Use creationRules method.
  • $is_update = false: Use updateRules method.

Note: if both $is_creation and $is_update are false it will use rules method.

License

This helper is released under the MIT License (MIT). Please see the included license file for more information.