Completed
Push — master ( dc322e...438d0e )
by Mahmoud
03:27
created

ValidationTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A extendValidationRules() 0 6 1
1
<?php
2
3
namespace App\Ship\Features\Validations;
4
5
use Validator;
6
7
/**
8
 * Class ValidationTrait
9
 *
10
 * @author  Mahmoud Zalt  <[email protected]>
11
 */
12
trait ValidationTrait
13
{
14
15
    /**
16
     * Extend the default Laravel validation rules.
17
     */
18
    public function extendValidationRules()
19
    {
20
        Validator::extend('no_spaces', function ($attr, $value) {
21
            return preg_match('/^\S*$/u', $value);
22
        }, ['String should not contain space.']);
23
    }
24
}
25