7
7
use GameapModules \Ftp \Exceptions \ExecuteCommandException ;
8
8
use GameapModules \Ftp \Models \FtpAccount ;
9
9
use GameapModules \Ftp \Services \CommandsService ;
10
- use Cache ;
10
+ use Illuminate \ Support \ Facades \ Cache ;
11
11
12
12
class FtpAccountRepository
13
13
{
14
- const EXEC_SUCCESS_CODE = 0 ;
14
+ public const EXEC_SUCCESS_CODE = 0 ;
15
15
16
- const CACHE_TTL_SECONDS = 300 ;
17
- const CACHE_LAST_ERROR_KEY = 'ftp:last_error ' ;
16
+ public const CACHE_TTL_SECONDS = 300 ;
17
+ public const CACHE_LAST_ERROR_KEY = 'ftp:last_error ' ;
18
18
19
19
/**
20
20
* @var CommandsService
@@ -43,6 +43,7 @@ public function store(array $attributes)
43
43
$ attributes ['username ' ],
44
44
$ attributes ['password ' ],
45
45
$ attributes ['dir ' ],
46
+ $ attributes ['user ' ] ?? '' ,
46
47
$ exitCode
47
48
);
48
49
@@ -60,7 +61,7 @@ public function store(array $attributes)
60
61
* @throws ExecuteCommandException
61
62
* @throws GameapException
62
63
*/
63
- function update (int $ id , array $ attributes )
64
+ public function update (int $ id , array $ attributes )
64
65
{
65
66
$ ftpAccount = FtpAccount::findOrFail ($ id );
66
67
@@ -69,6 +70,7 @@ function update(int $id, array $attributes)
69
70
$ attributes ['username ' ] ?? $ ftpAccount ->username ,
70
71
$ attributes ['password ' ],
71
72
$ attributes ['dir ' ],
73
+ $ attributes ['user ' ] ?? '' ,
72
74
$ exitCode
73
75
);
74
76
@@ -86,7 +88,7 @@ function update(int $id, array $attributes)
86
88
* @throws GameapException
87
89
* @throws Exception
88
90
*/
89
- function destroy (FtpAccount $ ftpAccount )
91
+ public function destroy (FtpAccount $ ftpAccount )
90
92
{
91
93
$ result = $ this ->commandsService ->deleteAccount (
92
94
$ ftpAccount ->ds_id ,
@@ -105,8 +107,8 @@ function destroy(FtpAccount $ftpAccount)
105
107
/**
106
108
* @return mixed
107
109
*/
108
- function lastError ()
110
+ public function lastError ()
109
111
{
110
112
return Cache::get (self ::CACHE_LAST_ERROR_KEY );
111
113
}
112
- }
114
+ }
0 commit comments