app/Http/Requests/Ride/StoreRideRequest.php
/**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
Get the validation rules that apply to the request.
@return array
Get the validation rules that apply to the request . @return array
public function rules()
    {
        $today = now()->toDateString();
        return [
            'route_id' => 'required|integer|exists:routes,id',
            'bus_id' => 'required|integer|exists:buses,id',
            'departure_time' => 'required|date_format:H:i',
            'auto_confirm' => 'boolean',
            'ride_type' => 'required|string',
            'ride_date' => "exclude_if:ride_type,cyclic|required|date|after_or_equal:$today",
            'days' => 'exclude_if:ride_type,single|required|array|min:1|',
            'start_date' => "exclude_if:ride_type,single|required|date|after_or_equal:$today",
            'end_date' => 'nullable|date|after:start_date'
        ];
    }
public function rules ( ) { $ today = now ( ) -> toDateString ( ) ; return [ 'route_id' => 'required|integer|exists:routes,id' , 'bus_id' => 'required|integer|exists:buses,id' , 'departure_time' => 'required|date_format:H:i' , 'auto_confirm' => 'boolean' , 'ride_type' => 'required|string' , 'ride_date' => " exclude_if:ride_type,cyclic|required|date|after_or_equal: $ today " , 'days' => 'exclude_if:ride_type,single|required|array|min:1|' , 'start_date' => " exclude_if:ride_type,single|required|date|after_or_equal: $ today " , 'end_date' => 'nullable|date|after:start_date' ] ; }
Get the validation rules that apply to the request.
Get the validation rules that apply to the request .