33namespace Pterodactyl \Repositories \Eloquent ;
44
55use Pterodactyl \Models \User ;
6- use Illuminate \Support \Collection ;
7- use Illuminate \Contracts \Pagination \LengthAwarePaginator ;
86use Pterodactyl \Contracts \Repository \UserRepositoryInterface ;
97
108class UserRepository extends EloquentRepository implements UserRepositoryInterface
@@ -18,43 +16,4 @@ public function model()
1816 {
1917 return User::class;
2018 }
21-
22- /**
23- * Return all matching models for a user in a format that can be used for dropdowns.
24- *
25- * @param string|null $query
26- * @return \Illuminate\Support\Collection
27- */
28- public function filterUsersByQuery (?string $ query ): Collection
29- {
30- $ this ->setColumns ([
31- 'id ' , 'email ' , 'username ' , 'name_first ' , 'name_last ' ,
32- ]);
33-
34- $ instance = $ this ->getBuilder ()->get ($ this ->getColumns ());
35-
36- return $ instance ->transform (function ($ item ) {
37- $ item ->md5 = md5 (strtolower ($ item ->email ));
38-
39- return $ item ;
40- });
41- }
42-
43- /**
44- * Returns a user with the given id in a format that can be used for dropdowns.
45- *
46- * @param int $id
47- * @return \Pterodactyl\Models\Model
48- */
49- public function filterById (int $ id ): \Pterodactyl \Models \Model
50- {
51- $ this ->setColumns ([
52- 'id ' , 'email ' , 'username ' , 'name_first ' , 'name_last ' ,
53- ]);
54-
55- $ model = $ this ->getBuilder ()->findOrFail ($ id , $ this ->getColumns ())->getModel ();
56- $ model ->md5 = md5 (strtolower ($ model ->email ));
57-
58- return $ model ;
59- }
6019}
0 commit comments