chilly2go

IPEditRequest

Aug 3rd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Requests;
  4.  
  5. use Illuminate\Foundation\Http\FormRequest;
  6. use Illuminate\Validation\Rule;
  7.  
  8. class IPEditRequest extends FormRequest
  9. {
  10.     /**
  11.      * Determine if the user is authorized to make this request.
  12.      *
  13.      * @return bool
  14.      */
  15.     public
  16.     function authorize()
  17.     {
  18.         // no permissions and stuff, yet
  19.         return TRUE;
  20.     }
  21.  
  22.     /**
  23.      * Get the validation rules that apply to the request.
  24.      *
  25.      * @return array
  26.      */
  27.     public
  28.     function rules()
  29.     {
  30.         return [
  31.  
  32.             "edit_ip"   => ["required", // self explanatory
  33.                             "ipv4",     //currently only v4
  34.                            
  35.                             // small list of unwanted entries
  36.                             Rule::notIn(['127.0.0.1', "255.255.255.255", "255.255.255.0", "255.255.0.0", "255.0.0.0"])],
  37.             "edit_name" => "nullable|string|min:2",
  38.  
  39.         ];
  40.     }
  41. }
Add Comment
Please, Sign In to add comment