“zuverlässige Validierung in Laravel” Code-Antworten

Laravel -Validierung

use Illuminate\Support\Facades\Validator;


$customMessage = [
  'title.max' => "title is too large",
];
$rules = [
  'id' => 'integer|exists:master_advert_bundles',
  'title' => ['required', 'unique:posts', 'max:255'],
  'body' => ['required']
];
$validate = validation($request->all(), $rules);
$validate = Validator::make($request->all(), $rules, $customMessage);
if ($validate->fails()) {
  return  $validate->messages();
}
Bored Bird

Laravel -Validierung

    $validated = $request->validate([
        'title' => 'required|unique:posts|max:255',
        'body' => 'required',
    ]);
YellowSnowman85

zuverlässige Validierung in Laravel

 'nriq'          => 'required',
            'nrim'          => 'required_if:nriq,Yes',
//multiple
  'cate'          => 'required',
   'ncl_cert' => 'required_if:cate,DT-VJ(A),NT(B),NT(D),OBC,SBC',
ashish basuri

zuverlässige Validierung in Laravel

              $('#formid').validate({
                  rules: {
                      inservice_quota: "required",
                      inservice_jion_date: {
                          required: function () {
                              if ($('#idofpreviousfield').val() === 'Yes') {
                                  return true;
                              } else {
                                  return false;
                              }
                          },
                      },
                      inservice_posting_addr: {
                          required: function () {
                              if ($('#InserviceQuota').val() === 'Yes') {
                                  return true;
                              } else {
                                  return false;
                              }
                          },
                      },
                      inservice_establish_noc:{
                          required: function () {
                              if ($('#InserviceQuota').val() === 'Yes') {
                                  return true;
                              } else {
                                  return false;
                              }
                          },
                      },
                      inservice_establish_noc_date:{
                          required: function () {
                              if ($('#Noc').val() === 'Yes') {
                                  return true;
                              } else {
                                  return false;
                              }
                          },
                      },
                      inservice_dept_enquiry:{
                          required: function () {
                              if ($('#InserviceQuota').val() === 'Yes') {
                                  return true;
                              } else {
                                  return false;
                              }
                          },
                      }
                  },
                  messages: {
                      inservice_quota:{
                        required :"Please Select Inservice Quota"
                      },
                      inservice_jion_date:{
                          required :"Please select Date of Joining Permanent Service"
                      },
      
                  },
                  submitHandler: function (form) {

                      var action = "{{ route('Quota.store') }}";

                      $.ajax({
                          url: action,
                          data: $(form).serialize(),
                          type: 'post',
                          success: function (result) {
                              console.log(result.status);
                              if (result.status == "success") {
                                  toastr.success(result.msg);
                              }
                          },
                          error: function (response) {
                              let data = response.responseJSON.errors;
                              if (data) {
                                  $.each(data, function (index, jsonObject) {
                                      $.each(jsonObject, function (key, val) {
                                          console.log(val);
                                          toastr.error(val);
                                      });
                                      return false;
                                  });
                              }
                          }
                      });
                  }
              });
ashish basuri

Ähnliche Antworten wie “zuverlässige Validierung in Laravel”

Fragen ähnlich wie “zuverlässige Validierung in Laravel”

Weitere verwandte Antworten zu “zuverlässige Validierung in Laravel” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen