Advertisement
muhidins

Validation.php - Jurusan

May 15th, 2020
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php namespace Config;
  2.  
  3. class Validation
  4. {
  5.     //--------------------------------------------------------------------
  6.     // Setup
  7.     //--------------------------------------------------------------------
  8.  
  9.     /**
  10.      * Stores the classes that contain the
  11.      * rules that are available.
  12.      *
  13.      * @var array
  14.      */
  15.     public $ruleSets = [
  16.         \CodeIgniter\Validation\Rules::class,
  17.         \CodeIgniter\Validation\FormatRules::class,
  18.         \CodeIgniter\Validation\FileRules::class,
  19.         \CodeIgniter\Validation\CreditCardRules::class,
  20.     ];
  21.  
  22.     /**
  23.      * Specifies the views that are used to display the
  24.      * errors.
  25.      *
  26.      * @var array
  27.      */
  28.     public $templates = [
  29.         'list'   => 'CodeIgniter\Validation\Views\list',
  30.         'single' => 'CodeIgniter\Validation\Views\single',
  31.     ];
  32.  
  33.     //--------------------------------------------------------------------
  34.     // Rules
  35.     //--------------------------------------------------------------------
  36.     public $jurusan = [
  37.         'jurusan' => 'required|string',
  38.         'kapasitas' => 'permit_empty|integer',
  39.         'terisi' => 'permit_empty|integer|less_than_equal_to[{kapasitas}]'
  40.     ];
  41.  
  42.     public $jurusan_errors = [
  43.         'jurusan' => [
  44.             'required' => 'Jurusan Wajid diisi',
  45.             'string' => 'Jurusan hanya dapat diisi string',
  46.         ],
  47.         'kapasitas' => [
  48.             'integer' => 'Kapasitas hanya dapat diisi Angka',
  49.         ],
  50.         'terisi' => [
  51.             'integer' => 'Terisi hanya dapat diisi Angka',
  52.             'less_than_equal_to' => 'Terisi harus kurang dari atau sama dengan Kapasitas',
  53.         ],
  54.     ];
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement