Exemplo n.º 1
0
 public function success($url)
 {
     $rule = Rule::where('short_url', $url)->first();
     if (!$rule) {
         $view = view('errors.404');
         return response($view, 404);
     }
     return view('success')->with('data', $rule);
 }
Exemplo n.º 2
0
 public function validatePut($data)
 {
     $ipv4Regex = '/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/';
     if (preg_match($ipv4Regex, $data['source']) == 0) {
         if ($data['source'] == '*') {
             $this->rules['source'] = 'between:1,15';
         } else {
             $this->rules['source'] = 'between:1,15|ip';
         }
     }
     if (preg_match($ipv4Regex, $data['destination']) == 0) {
         if ($data['destination'] == '*') {
             $this->rules['destination'] = 'between:1,15';
         } else {
             $this->rules['destination'] = 'between:1,15|ip';
         }
     }
     $ruleName = Rule::where('name', $data['name'])->first();
     if ($ruleName != null && $ruleName->name != $data['name']) {
         $this->rulesPut['name'] = 'unique:rules|between:1,20';
     }
     return Validator::make($data, $this->rulesPut, $this->messagesPut);
 }
Exemplo n.º 3
0
 public function deleteLinks()
 {
     $input = Input::only('_id');
     $rule = Rule::where('_id', $input['_id'])->delete();
     return response()->json($rule);
 }