NotGuestLtid   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 32
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A message() 0 3 1
A passes() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Rules;
4
5
use Illuminate\Contracts\Validation\Rule;
6
7
class NotGuestLtid implements Rule
8
{
9
    /**
10
     * Create a new rule instance.
11
     *
12
     * @return void
13
     */
14
    public function __construct()
15
    {
16
        $this->user = \Auth::user();
0 ignored issues
show
Bug Best Practice introduced by
The property user does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
17
    }
18
19
    /**
20
     * Determine if the validation rule passes.
21
     *
22
     * @param  string  $attribute
23
     * @param  mixed  $value
24
     * @return bool
25
     */
26
    public function passes($attribute, $value)
27
    {
28
        return $value != $this->user->guest_ltid;
0 ignored issues
show
Bug introduced by
The property guest_ltid does not seem to exist on App\User. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
29
    }
30
31
    /**
32
     * Get the validation error message.
33
     *
34
     * @return string
35
     */
36
    public function message()
37
    {
38
        return 'The validation error message.';
39
    }
40
}
41