1 | <?php |
||
8 | class UserSecurity extends ChocolateyModel |
||
9 | { |
||
10 | /** |
||
11 | * Disable Timestamps. |
||
12 | * |
||
13 | * @var bool |
||
14 | */ |
||
15 | public $timestamps = false; |
||
16 | |||
17 | /** |
||
18 | * The table associated with the model. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $table = 'chocolatey_users_security'; |
||
23 | |||
24 | /** |
||
25 | * Primary Key of the Table. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $primaryKey = 'user_id'; |
||
30 | |||
31 | /** |
||
32 | * The attributes excluded from the model's JSON form. |
||
33 | * |
||
34 | * @var array |
||
35 | */ |
||
36 | protected $hidden = ['user_id']; |
||
37 | |||
38 | /** |
||
39 | * The Appender(s) of the Model. |
||
40 | * |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $appends = [ |
||
44 | 'trustedDevices', |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * The attributes that are mass assignable. |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $fillable = ['user_id', 'firstQuestion', 'secondQuestion', 'firstAnswer', 'secondAnswer']; |
||
53 | |||
54 | /** |
||
55 | * Get Trusted Devices. |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | public function getTrustedDevicesAttribute(): array |
||
65 | |||
66 | /** |
||
67 | * Store a new User Security Metadata. |
||
68 | * |
||
69 | * @param int $userId |
||
70 | * @param int $firstQuestion |
||
71 | * @param int $secondQuestion |
||
72 | * @param string $firstAnswer |
||
73 | * @param string $secondAnswer |
||
74 | * |
||
75 | * @return UserSecurity |
||
76 | */ |
||
77 | public function store(int $userId, int $firstQuestion, int $secondQuestion, string $firstAnswer, string $secondAnswer): UserSecurity |
||
88 | } |
||
89 |