This repository was archived by the owner on Feb 14, 2021. It is now read-only.
File tree 3 files changed +79
-2
lines changed
3 files changed +79
-2
lines changed Original file line number Diff line number Diff line change 5
5
"license" : " GPL-3.0" ,
6
6
"minimum-stability" : " stable" ,
7
7
"require" : {
8
- "par0noid/ts3admin" : " dev-composer"
8
+ "par0noid/ts3admin" : " dev-composer" ,
9
+ "laravel/framework" : " ^5.3"
9
10
},
10
11
"version" : " 0.0.1" ,
11
12
"autoload" : {
12
13
"psr-4" : {
13
- "Micky5991\\ laravel-ts3admin " : " src"
14
+ "Micky5991\\ laravel_ts3admin \\ " : " src"
14
15
}
15
16
},
16
17
"repositories" : [
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Micky5991 \laravel_ts3admin \Exceptions ;
3
+
4
+ use Exception ;
5
+ use par0noid \ts3admin \ts3admin ;
6
+
7
+ class TeamspeakException extends Exception
8
+ {
9
+
10
+ public function __construct (ts3admin $ ts , Exception $ previous = NULL )
11
+ {
12
+ $ messages = $ ts ->getDebugLog ();
13
+ parent ::__construct (end ($ messages ), 0 , $ previous );
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Micky5991 \laravel_ts3admin \Providers ;
4
+
5
+ use Illuminate \Support \ServiceProvider ;
6
+ use par0noid \ts3admin \ts3admin ;
7
+
8
+ class TeamspeakServiceProvider extends ServiceProvider
9
+ {
10
+ public $ defer = true ;
11
+
12
+ /**
13
+ * Bootstrap the application services.
14
+ *
15
+ * @return void
16
+ */
17
+ public function boot ()
18
+ {
19
+ //
20
+ }
21
+
22
+ /**
23
+ * Register the application services.
24
+ *
25
+ * @return void
26
+ */
27
+ public function register ()
28
+ {
29
+ $ this ->app ->singleton (ts3admin::class, function ($ app ) {
30
+ $ ts = new ts3admin (
31
+ env ('TS_HOST ' , '127.0.0.1 ' ),
32
+ env ('TS_QUERY_PORT ' , 10011 ),
33
+ env ('TS_QUERY_SOCKET_TIMEOUT ' , 2 )
34
+ );
35
+ if ($ ts ->succeeded ($ ts ->connect ())) {
36
+ if ($ ts ->succeeded (
37
+ $ ts ->login (
38
+ env ('TS_QUERY_USER ' , 'serveradmin ' ),
39
+ env ('TS_QUERY_PASS ' )
40
+ )
41
+ )) {
42
+ if ($ ts ->succeeded ($ ts ->selectServer (env ('TS_SERVER_PORT ' , 9987 )))) {
43
+ return $ ts ;
44
+ }
45
+ }
46
+ }
47
+ throw new TeamspeakException ($ ts );
48
+ });
49
+ }
50
+
51
+ /**
52
+ * Get the services provided by the provider.
53
+ *
54
+ * @return array
55
+ */
56
+ public function provides ()
57
+ {
58
+ return [ts3admin::class];
59
+ }
60
+ }
You can’t perform that action at this time.
0 commit comments