Passed
Push — master ( d6b3f4...e465ee )
by Hayri Can
01:15
created
routes/web.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
  * @link      https://github.com/HayriCan/laravel-ip-checker
9 9
  */
10 10
 
11
-Route::group(['prefix'=>config('ipchecker.settings.route_prefix')], function () {
11
+Route::group(['prefix'=>config('ipchecker.settings.route_prefix')], function() {
12 12
     Route::get('/iplists', 'HayriCan\IpChecker\Http\Controllers\IpCheckerController@index')->name('iplist.index');
13 13
     Route::post('/ip-add', 'HayriCan\IpChecker\Http\Controllers\IpCheckerController@add')->name('iplist.add');
14 14
     Route::delete('/ip-delete', 'HayriCan\IpChecker\Http\Controllers\IpCheckerController@delete')->name('iplist.delete');
Please login to merge, or discard this patch.
src/IpCheckerServiceProvider.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     public function register()
29 29
     {
30 30
         $this->mergeConfigFrom(
31
-            __DIR__ . '/../config/ipchecker.php', 'ipchecker'
31
+            __DIR__.'/../config/ipchecker.php', 'ipchecker'
32 32
         );
33 33
         $this->bindServices();
34 34
     }
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
         $this->loadConfig();
38 38
         $this->loadRoutes();
39 39
         $this->loadViews();
40
-        if (config('ipchecker.driver') === 'db'){
40
+        if (config('ipchecker.driver') === 'db') {
41 41
             $this->loadMigrations();
42 42
         }
43 43
         $this->loadTranslation();
44 44
     }
45 45
 
46
-    public function bindServices(){
46
+    public function bindServices() {
47 47
         $driver = config('ipchecker.driver');
48 48
         switch ($driver) {
49 49
             case 'file':
@@ -56,36 +56,36 @@  discard block
 block discarded – undo
56 56
                 throw new Exception("Unsupported Driver");
57 57
                 break;
58 58
         }
59
-        $this->app->singleton(IpCheckerInterface::class,$instance);
59
+        $this->app->singleton(IpCheckerInterface::class, $instance);
60 60
 
61
-        $this->app->singleton('ipchecker', function ($app) use ($instance){
61
+        $this->app->singleton('ipchecker', function($app) use ($instance){
62 62
             return new IpChecker($app->make($instance));
63 63
         });
64 64
     }
65 65
 
66
-    public function loadConfig(){
66
+    public function loadConfig() {
67 67
         $this->publishes([
68
-            __DIR__ . '/../config/ipchecker.php' => config_path('ipchecker.php')
68
+            __DIR__.'/../config/ipchecker.php' => config_path('ipchecker.php')
69 69
         ], 'ipchecker');
70 70
     }
71 71
 
72
-    public function loadRoutes(){
73
-        $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
72
+    public function loadRoutes() {
73
+        $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
74 74
     }
75 75
 
76
-    public function loadViews(){
77
-        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'ipchecker');
76
+    public function loadViews() {
77
+        $this->loadViewsFrom(__DIR__.'/../resources/views', 'ipchecker');
78 78
     }
79 79
 
80
-    public function loadMigrations(){
81
-        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
80
+    public function loadMigrations() {
81
+        $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
82 82
     }
83 83
 
84
-    public function loadTranslation(){
85
-        $this->loadTranslationsFrom(__DIR__ . '/lang', 'ipchecker');
84
+    public function loadTranslation() {
85
+        $this->loadTranslationsFrom(__DIR__.'/lang', 'ipchecker');
86 86
 
87 87
         $this->publishes([
88
-            __DIR__ . '/lang' => resource_path('lang/vendor/ipchecker'),
88
+            __DIR__.'/lang' => resource_path('lang/vendor/ipchecker'),
89 89
         ], 'ipchecker');
90 90
     }
91 91
 
Please login to merge, or discard this patch.
src/Contracts/IpCheckerInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  * @license   http://www.opensource.org/licenses/mit-license.php MIT
10 10
  * @link      https://github.com/HayriCan/laravel-ip-checker
11 11
  */
12
-interface IpCheckerInterface{
12
+interface IpCheckerInterface {
13 13
 
14 14
     public function getIpArray();
15 15
     /**
Please login to merge, or discard this patch.
src/Http/Middleware/IpChecker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,17 +35,17 @@
 block discarded – undo
35 35
             $code = trans('ipchecker::messages.denied_access.code');
36 36
             $message = trans('ipchecker::messages.denied_access.message');
37 37
 
38
-            if (in_array(config('ipchecker.api_middleware'),$request->route()->gatherMiddleware())){
38
+            if (in_array(config('ipchecker.api_middleware'), $request->route()->gatherMiddleware())) {
39 39
                 $return_array = [
40 40
                     'success'=>false,
41 41
                     'code'=>$code,
42 42
                     'message'=>$message,
43 43
                 ];
44 44
 
45
-                return response()->json($return_array,200,[],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
45
+                return response()->json($return_array, 200, [], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
46 46
             }
47 47
 
48
-            return response()->view('ipchecker::error',compact('message','code'));
48
+            return response()->view('ipchecker::error', compact('message', 'code'));
49 49
         }
50 50
 
51 51
         return $next($request);
Please login to merge, or discard this patch.
src/Http/Controllers/IpCheckerController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $this->middleware(['web']);
28 28
         if (config('ipchecker.settings.auth')) {
29
-            $this->middleware(['web','auth']);
29
+            $this->middleware(['web', 'auth']);
30 30
         }
31 31
     }
32 32
 
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
     {
41 41
         $iplist = $ipchecker->getIpList();
42 42
 
43
-        if(count($iplist)>0){
43
+        if (count($iplist)>0) {
44 44
             $iplist = $iplist->sortByDesc('created_at');
45 45
         }
46 46
 
47
-        return view('ipchecker::index',compact('iplist'));
47
+        return view('ipchecker::index', compact('iplist'));
48 48
     }
49 49
 
50 50
     /**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @param IpCheckerInterface $ipchecker
53 53
      * @return \Illuminate\Http\RedirectResponse
54 54
      */
55
-    public function add(Request $request,IpCheckerInterface $ipchecker)
55
+    public function add(Request $request, IpCheckerInterface $ipchecker)
56 56
     {
57 57
         $request_data = $request->all();
58 58
         $request_validation = array(
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
             return redirect()->back()->withErrors($validator->errors());
66 66
         }
67 67
 
68
-        if (!in_array($request->input('ip'),$ipchecker->getIpArray())){
68
+        if (!in_array($request->input('ip'), $ipchecker->getIpArray())) {
69 69
             $ipchecker->saveIp(array(
70 70
                 'group'=>$request->input('group'),
71 71
                 'definition'=>$request->input('definition'),
72 72
                 'ip'=>$request->input('ip'),
73 73
             ));
74 74
 
75
-            return redirect()->back()->with('success',trans('ipchecker::messages.ip_success'));
75
+            return redirect()->back()->with('success', trans('ipchecker::messages.ip_success'));
76 76
         }
77 77
 
78
-        return redirect()->back()->with('error',trans('ipchecker::messages.ip_error'));
78
+        return redirect()->back()->with('error', trans('ipchecker::messages.ip_error'));
79 79
     }
80 80
 
81 81
     /**
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
      * @param IpCheckerInterface $ipchecker
84 84
      * @return \Illuminate\Http\RedirectResponse
85 85
      */
86
-    public function delete(Request $request,IpCheckerInterface $ipchecker)
86
+    public function delete(Request $request, IpCheckerInterface $ipchecker)
87 87
     {
88 88
         $ipchecker->deleteIp($request->input('ipAddress'));
89 89
 
90
-        return redirect()->back()->with('info',trans('ipchecker::messages.ip_delete'));
90
+        return redirect()->back()->with('info', trans('ipchecker::messages.ip_delete'));
91 91
     }
92 92
 }
Please login to merge, or discard this patch.