noblemfd
4 months ago
530
1
Laravel

How to format date in Unique Rules

Posted 4 months ago by noblemfd

In my Laravel5.8 project I have this Unique Rules code:

        'goal_type_id' => [
            'required', 
            Rule::unique('appraisal_goals')->where(function ($query) {
           return $query->where('appraisal_identity_id', $this->appraisal_identity_id)
                ->where('goal_type_id', $this->goal_type_id)
              ->where('start_date', $this->start_date);
        })               
        ],

How do I format my start_date in the code to:

            'date',
            'date_format:Y-m-d',

Thank you

Please sign in or create an account to participate in this conversation.