“validasi yang dapat diandalkan di Laravel” Kode Jawaban

Validasi Laravel

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

Validasi Laravel

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

validasi yang dapat diandalkan di 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

validasi yang dapat diandalkan di 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

Jawaban yang mirip dengan “validasi yang dapat diandalkan di Laravel”

Pertanyaan yang mirip dengan “validasi yang dapat diandalkan di Laravel”

Lebih banyak jawaban terkait untuk “validasi yang dapat diandalkan di Laravel” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya