Completed
Push — master ( 95c0c1...518882 )
by Sherif
02:08
created
files/Handler.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,81 +7,81 @@
 block discarded – undo
7 7
 
8 8
 class Handler extends ExceptionHandler
9 9
 {
10
-    /**
11
-     * A list of the exception types that are not reported.
12
-     *
13
-     * @var array
14
-     */
15
-    protected $dontReport = [
16
-        \League\OAuth2\Server\Exception\OAuthServerException::class,
17
-    ];
10
+	/**
11
+	 * A list of the exception types that are not reported.
12
+	 *
13
+	 * @var array
14
+	 */
15
+	protected $dontReport = [
16
+		\League\OAuth2\Server\Exception\OAuthServerException::class,
17
+	];
18 18
 
19
-    /**
20
-     * A list of the inputs that are never flashed for validation exceptions.
21
-     *
22
-     * @var array
23
-     */
24
-    protected $dontFlash = [
25
-        'password',
26
-        'password_confirmation',
27
-    ];
19
+	/**
20
+	 * A list of the inputs that are never flashed for validation exceptions.
21
+	 *
22
+	 * @var array
23
+	 */
24
+	protected $dontFlash = [
25
+		'password',
26
+		'password_confirmation',
27
+	];
28 28
 
29
-    /**
30
-     * Report or log an exception.
31
-     *
32
-     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
33
-     *
34
-     * @param  \Exception  $exception
35
-     * @return void
36
-     */
37
-    public function report(Exception $exception)
38
-    {
39
-        parent::report($exception);
40
-    }
29
+	/**
30
+	 * Report or log an exception.
31
+	 *
32
+	 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
33
+	 *
34
+	 * @param  \Exception  $exception
35
+	 * @return void
36
+	 */
37
+	public function report(Exception $exception)
38
+	{
39
+		parent::report($exception);
40
+	}
41 41
 
42
-    /**
43
-     * Render an exception into an HTTP response.
44
-     *
45
-     * @param  \Illuminate\Http\Request  $request
46
-     * @param  \Exception  $exception
47
-     * @return \Illuminate\Http\Response
48
-     */
49
-    public function render($request, Exception $exception)
50
-    {
51
-        if ($request->wantsJson())
52
-        {
53
-            if ($exception instanceof \Illuminate\Auth\AuthenticationException) 
54
-            {
55
-                \ErrorHandler::unAuthorized();
56
-            }
57
-            if ($exception instanceof \Illuminate\Database\QueryException) 
58
-            {
59
-                \ErrorHandler::dbQueryError();
60
-            }
61
-            else if ($exception instanceof \predis\connection\connectionexception) 
62
-            {
63
-                \ErrorHandler::redisNotRunning();
64
-            }
65
-            else if ($exception instanceof \GuzzleHttp\Exception\ClientException) 
66
-            {
67
-                \ErrorHandler::connectionError();
68
-            }
69
-            else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) 
70
-            {
71
-                return \Response::json($exception->getMessage(), $exception->getStatusCode());   
72
-            }
73
-            else if ($exception instanceof \Illuminate\Validation\ValidationException) 
74
-            {
75
-                return \Response::json($exception->errors(), 422);   
76
-            }
77
-            else if ( ! $exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException)
78
-            {
79
-                return parent::render($request, $exception);
80
-            }
81
-        }
82
-        else
83
-        {
84
-            return parent::render($request, $exception);
85
-        }
86
-    }
42
+	/**
43
+	 * Render an exception into an HTTP response.
44
+	 *
45
+	 * @param  \Illuminate\Http\Request  $request
46
+	 * @param  \Exception  $exception
47
+	 * @return \Illuminate\Http\Response
48
+	 */
49
+	public function render($request, Exception $exception)
50
+	{
51
+		if ($request->wantsJson())
52
+		{
53
+			if ($exception instanceof \Illuminate\Auth\AuthenticationException) 
54
+			{
55
+				\ErrorHandler::unAuthorized();
56
+			}
57
+			if ($exception instanceof \Illuminate\Database\QueryException) 
58
+			{
59
+				\ErrorHandler::dbQueryError();
60
+			}
61
+			else if ($exception instanceof \predis\connection\connectionexception) 
62
+			{
63
+				\ErrorHandler::redisNotRunning();
64
+			}
65
+			else if ($exception instanceof \GuzzleHttp\Exception\ClientException) 
66
+			{
67
+				\ErrorHandler::connectionError();
68
+			}
69
+			else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) 
70
+			{
71
+				return \Response::json($exception->getMessage(), $exception->getStatusCode());   
72
+			}
73
+			else if ($exception instanceof \Illuminate\Validation\ValidationException) 
74
+			{
75
+				return \Response::json($exception->errors(), 422);   
76
+			}
77
+			else if ( ! $exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException)
78
+			{
79
+				return parent::render($request, $exception);
80
+			}
81
+		}
82
+		else
83
+		{
84
+			return parent::render($request, $exception);
85
+		}
86
+	}
87 87
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -57,29 +57,23 @@
 block discarded – undo
57 57
             if ($exception instanceof \Illuminate\Database\QueryException) 
58 58
             {
59 59
                 \ErrorHandler::dbQueryError();
60
-            }
61
-            else if ($exception instanceof \predis\connection\connectionexception) 
60
+            } else if ($exception instanceof \predis\connection\connectionexception) 
62 61
             {
63 62
                 \ErrorHandler::redisNotRunning();
64
-            }
65
-            else if ($exception instanceof \GuzzleHttp\Exception\ClientException) 
63
+            } else if ($exception instanceof \GuzzleHttp\Exception\ClientException) 
66 64
             {
67 65
                 \ErrorHandler::connectionError();
68
-            }
69
-            else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) 
66
+            } else if ($exception instanceof \Symfony\Component\HttpKernel\Exception\HttpException) 
70 67
             {
71 68
                 return \Response::json($exception->getMessage(), $exception->getStatusCode());   
72
-            }
73
-            else if ($exception instanceof \Illuminate\Validation\ValidationException) 
69
+            } else if ($exception instanceof \Illuminate\Validation\ValidationException) 
74 70
             {
75 71
                 return \Response::json($exception->errors(), 422);   
76
-            }
77
-            else if ( ! $exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException)
72
+            } else if ( ! $exception instanceof \Symfony\Component\Debug\Exception\FatalErrorException)
78 73
             {
79 74
                 return parent::render($request, $exception);
80 75
             }
81
-        }
82
-        else
76
+        } else
83 77
         {
84 78
             return parent::render($request, $exception);
85 79
         }
Please login to merge, or discard this patch.
files/BroadcastServiceProvider.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@
 block discarded – undo
7 7
 
8 8
 class BroadcastServiceProvider extends ServiceProvider
9 9
 {
10
-    /**
11
-     * Bootstrap any application services.
12
-     *
13
-     * @return void
14
-     */
15
-    public function boot()
16
-    {
17
-        Broadcast::routes(['middleware' => ['auth:api']]);
10
+	/**
11
+	 * Bootstrap any application services.
12
+	 *
13
+	 * @return void
14
+	 */
15
+	public function boot()
16
+	{
17
+		Broadcast::routes(['middleware' => ['auth:api']]);
18 18
 
19
-        require base_path('routes/channels.php');
20
-    }
19
+		require base_path('routes/channels.php');
20
+	}
21 21
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Notifications/ConfirmEmail.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      * Get the notification's delivery channels.
29 29
      *
30 30
      * @param  mixed  $notifiable
31
-     * @return array
31
+     * @return string[]
32 32
      */
33 33
     public function via($notifiable)
34 34
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use Illuminate\Notifications\Notification;
7 7
 use Illuminate\Contracts\Queue\ShouldQueue;
8 8
 use Illuminate\Notifications\Messages\MailMessage;
9
-use Illuminate\Notifications\Messages\BroadcastMessage;
10 9
 
11 10
 class ConfirmEmail extends Notification implements ShouldQueue
12 11
 {
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,41 +10,41 @@
 block discarded – undo
10 10
 
11 11
 class ConfirmEmail extends Notification implements ShouldQueue
12 12
 {
13
-    use Queueable;
13
+	use Queueable;
14 14
 
15
-    /**
16
-     * Create a new notification instance.
17
-     *
18
-     * @return void
19
-     */
20
-    public function __construct()
21
-    {
22
-        //
23
-    }
15
+	/**
16
+	 * Create a new notification instance.
17
+	 *
18
+	 * @return void
19
+	 */
20
+	public function __construct()
21
+	{
22
+		//
23
+	}
24 24
 
25
-    /**
26
-     * Get the notification's delivery channels.
27
-     *
28
-     * @param  mixed  $notifiable
29
-     * @return array
30
-     */
31
-    public function via($notifiable)
32
-    {
33
-        return ['mail'];
34
-    }
25
+	/**
26
+	 * Get the notification's delivery channels.
27
+	 *
28
+	 * @param  mixed  $notifiable
29
+	 * @return array
30
+	 */
31
+	public function via($notifiable)
32
+	{
33
+		return ['mail'];
34
+	}
35 35
 
36
-    /**
37
-     * Get the mail representation of the notification.
38
-     *
39
-     * @param  mixed  $notifiable
40
-     * @return \Illuminate\Notifications\Messages\MailMessage
41
-     */
42
-    public function toMail($notifiable)
43
-    {
44
-        return (new MailMessage)
45
-            ->subject('Email verification')
46
-            ->line('Email verification')
47
-            ->line('To validate your email click on the button below')
48
-            ->action('Verify your email', config('skeleton.confrim_email_url') . '/' . $notifiable->confirmation_code);
49
-    }
36
+	/**
37
+	 * Get the mail representation of the notification.
38
+	 *
39
+	 * @param  mixed  $notifiable
40
+	 * @return \Illuminate\Notifications\Messages\MailMessage
41
+	 */
42
+	public function toMail($notifiable)
43
+	{
44
+		return (new MailMessage)
45
+			->subject('Email verification')
46
+			->line('Email verification')
47
+			->line('To validate your email click on the button below')
48
+			->action('Verify your email', config('skeleton.confrim_email_url') . '/' . $notifiable->confirmation_code);
49
+	}
50 50
 }
51 51
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,6 +45,6 @@
 block discarded – undo
45 45
             ->subject('Email verification')
46 46
             ->line('Email verification')
47 47
             ->line('To validate your email click on the button below')
48
-            ->action('Verify your email', config('skeleton.confrim_email_url') . '/' . $notifiable->confirmation_code);
48
+            ->action('Verify your email', config('skeleton.confrim_email_url').'/'.$notifiable->confirmation_code);
49 49
     }
50 50
 }
51 51
\ No newline at end of file
Please login to merge, or discard this patch.
files/Kernel.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -9,37 +9,37 @@
 block discarded – undo
9 9
 
10 10
 class Kernel extends ConsoleKernel
11 11
 {
12
-    /**
13
-     * The Artisan commands provided by your application.
14
-     *
15
-     * @var array
16
-     */
17
-    protected $commands = [
18
-        GenerateDoc::class,
19
-        MakeNotificationsCommand::class
20
-    ];
12
+	/**
13
+	 * The Artisan commands provided by your application.
14
+	 *
15
+	 * @var array
16
+	 */
17
+	protected $commands = [
18
+		GenerateDoc::class,
19
+		MakeNotificationsCommand::class
20
+	];
21 21
 
22
-    /**
23
-     * Define the application's command schedule.
24
-     *
25
-     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
26
-     * @return void
27
-     */
28
-    protected function schedule(Schedule $schedule)
29
-    {
30
-        // $schedule->command('inspire')
31
-        //          ->hourly();
32
-    }
22
+	/**
23
+	 * Define the application's command schedule.
24
+	 *
25
+	 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
26
+	 * @return void
27
+	 */
28
+	protected function schedule(Schedule $schedule)
29
+	{
30
+		// $schedule->command('inspire')
31
+		//          ->hourly();
32
+	}
33 33
 
34
-    /**
35
-     * Register the commands for the application.
36
-     *
37
-     * @return void
38
-     */
39
-    protected function commands()
40
-    {
41
-        $this->load(__DIR__.'/Commands');
34
+	/**
35
+	 * Register the commands for the application.
36
+	 *
37
+	 * @return void
38
+	 */
39
+	protected function commands()
40
+	{
41
+		$this->load(__DIR__.'/Commands');
42 42
 
43
-        require base_path('routes/console.php');
44
-    }
43
+		require base_path('routes/console.php');
44
+	}
45 45
 }
Please login to merge, or discard this patch.
src/Modules/Core/Utl/CoreConfig.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 class CoreConfig
4 4
 {
5
-    public function getConfig()
6
-    {
7
-        return [
5
+	public function getConfig()
6
+	{
7
+		return [
8 8
 			/**
9 9
 			 * Specify what relations should be used for every model.
10 10
 			 */
@@ -14,5 +14,5 @@  discard block
 block discarded – undo
14 14
 			 */
15 15
 			'cacheConfig' =>  config('skeleton.cache_config'),
16 16
 		];
17
-    }
17
+	}
18 18
 }
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
src/ApiSkeletonServiceProvider.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -6,38 +6,38 @@
 block discarded – undo
6 6
 
7 7
 class ApiSkeletonServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Perform post-registration booting of services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->publishes([
17
-            __DIR__.'/Modules'                               => app_path('Modules'),
18
-            __DIR__.'/Modules/Core/Resources/Assets'         => base_path('public/doc/assets'),
19
-            __DIR__.'/../lang'                               => base_path('resources/lang'),
20
-            __DIR__.'/../files/Handler.php'                  => app_path('Exceptions/Handler.php'),
21
-            __DIR__.'/../files/AuthServiceProvider.php'      => app_path('Providers/AuthServiceProvider.php'),
22
-            __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'),
23
-            __DIR__.'/../files/Kernel.php'                   => app_path('Console/Kernel.php'),
24
-        ]);
9
+	/**
10
+	 * Perform post-registration booting of services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->publishes([
17
+			__DIR__.'/Modules'                               => app_path('Modules'),
18
+			__DIR__.'/Modules/Core/Resources/Assets'         => base_path('public/doc/assets'),
19
+			__DIR__.'/../lang'                               => base_path('resources/lang'),
20
+			__DIR__.'/../files/Handler.php'                  => app_path('Exceptions/Handler.php'),
21
+			__DIR__.'/../files/AuthServiceProvider.php'      => app_path('Providers/AuthServiceProvider.php'),
22
+			__DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'),
23
+			__DIR__.'/../files/Kernel.php'                   => app_path('Console/Kernel.php'),
24
+		]);
25 25
 
26
-        $this->publishes([
27
-            __DIR__.'/../config/skeleton.php' => config_path('skeleton.php'),
28
-            __DIR__.'/../files/auth.php'      => config_path('auth.php'),
29
-        ], 'config');
30
-    }
26
+		$this->publishes([
27
+			__DIR__.'/../config/skeleton.php' => config_path('skeleton.php'),
28
+			__DIR__.'/../files/auth.php'      => config_path('auth.php'),
29
+		], 'config');
30
+	}
31 31
 
32
-    /**
33
-     * Register any package services.
34
-     *
35
-     * @return void
36
-     */
37
-    public function register()
38
-    {
39
-        $this->mergeConfigFrom(
40
-            __DIR__.'/../config/skeleton.php', 'skeleton'
41
-        );
42
-    }
32
+	/**
33
+	 * Register any package services.
34
+	 *
35
+	 * @return void
36
+	 */
37
+	public function register()
38
+	{
39
+		$this->mergeConfigFrom(
40
+			__DIR__.'/../config/skeleton.php', 'skeleton'
41
+		);
42
+	}
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/Core/Utl/ErrorHandler.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -2,117 +2,117 @@
 block discarded – undo
2 2
 
3 3
 class ErrorHandler
4 4
 {
5
-    public function unAuthorized()
6
-    {
7
-        $error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')];
8
-        abort($error['status'], $error['message']);
9
-    }
10
-
11
-    public function invalidRefreshToken()
12
-    {
13
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')];
14
-        abort($error['status'], $error['message']);
15
-    }
16
-
17
-     public function noPermissions()
18
-    {
19
-        $error = ['status' => 403, 'message' => trans('core::errors.noPermissions')];
20
-        abort($error['status'], $error['message']);
21
-    }
22
-
23
-    public function loginFailed()
24
-    {
25
-        $error = ['status' => 400, 'message' => trans('core::errors.loginFailed')];
26
-        abort($error['status'], $error['message']);
27
-    }
28
-
29
-    public function noSocialEmail()
30
-    {
31
-        $error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')];
32
-        abort($error['status'], $error['message']);
33
-    }
34
-
35
-    public function userAlreadyRegistered()
36
-    {
37
-        $error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')];
38
-        abort($error['status'], $error['message']);
39
-    }
40
-
41
-    public function connectionError()
42
-    {
43
-        $error = ['status' => 400, 'message' => trans('core::errors.connectionError')];
44
-        abort($error['status'], $error['message']);
45
-    }
46
-
47
-    public function redisNotRunning()
48
-    {
49
-        $error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')];
50
-        abort($error['status'], $error['message']);
51
-    }
52
-
53
-    public function dbQueryError()
54
-    {
55
-        $error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')];
56
-        abort($error['status'], $error['message']);
57
-    }
58
-
59
-    public function cannotCreateSetting()
60
-    {
61
-        $error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')];
62
-        abort($error['status'], $error['message']);
63
-    }
64
-
65
-    public function cannotUpdateSettingKey()
66
-    {
67
-        $error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')];
68
-        abort($error['status'], $error['message']);
69
-    }
70
-
71
-    public function userIsBlocked()
72
-    {
73
-        $error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')];
74
-        abort($error['status'], $error['message']);
75
-    }
76
-
77
-    public function emailNotConfirmed()
78
-    {
79
-        $error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')];
80
-        abort($error['status'], $error['message']);
81
-    }
82
-
83
-    public function emailAlreadyConfirmed()
84
-    {
85
-        $error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')];
86
-        abort($error['status'], $error['message']);
87
-    }
88
-
89
-    public function invalidResetToken()
90
-    {
91
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')];
92
-        abort($error['status'], $error['message']);
93
-    }
94
-
95
-    public function invalidResetPassword()
96
-    {
97
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')];
98
-        abort($error['status'], $error['message']);
99
-    }
100
-
101
-    public function invalidOldPassword()
102
-    {
103
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')];
104
-        abort($error['status'], $error['message']);
105
-    }
106
-
107
-    public function notFound($text)
108
-    {
109
-        $error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])];
110
-        abort($error['status'], $error['message']);
111
-    }
112
-
113
-    public function generalError()
114
-    {
115
-        $error = ['status' => 400, 'message' => trans('core::errors.generalError')];
116
-        abort($error['status'], $error['message']);
117
-    }
5
+	public function unAuthorized()
6
+	{
7
+		$error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')];
8
+		abort($error['status'], $error['message']);
9
+	}
10
+
11
+	public function invalidRefreshToken()
12
+	{
13
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')];
14
+		abort($error['status'], $error['message']);
15
+	}
16
+
17
+	 public function noPermissions()
18
+	{
19
+		$error = ['status' => 403, 'message' => trans('core::errors.noPermissions')];
20
+		abort($error['status'], $error['message']);
21
+	}
22
+
23
+	public function loginFailed()
24
+	{
25
+		$error = ['status' => 400, 'message' => trans('core::errors.loginFailed')];
26
+		abort($error['status'], $error['message']);
27
+	}
28
+
29
+	public function noSocialEmail()
30
+	{
31
+		$error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')];
32
+		abort($error['status'], $error['message']);
33
+	}
34
+
35
+	public function userAlreadyRegistered()
36
+	{
37
+		$error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')];
38
+		abort($error['status'], $error['message']);
39
+	}
40
+
41
+	public function connectionError()
42
+	{
43
+		$error = ['status' => 400, 'message' => trans('core::errors.connectionError')];
44
+		abort($error['status'], $error['message']);
45
+	}
46
+
47
+	public function redisNotRunning()
48
+	{
49
+		$error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')];
50
+		abort($error['status'], $error['message']);
51
+	}
52
+
53
+	public function dbQueryError()
54
+	{
55
+		$error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')];
56
+		abort($error['status'], $error['message']);
57
+	}
58
+
59
+	public function cannotCreateSetting()
60
+	{
61
+		$error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')];
62
+		abort($error['status'], $error['message']);
63
+	}
64
+
65
+	public function cannotUpdateSettingKey()
66
+	{
67
+		$error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')];
68
+		abort($error['status'], $error['message']);
69
+	}
70
+
71
+	public function userIsBlocked()
72
+	{
73
+		$error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')];
74
+		abort($error['status'], $error['message']);
75
+	}
76
+
77
+	public function emailNotConfirmed()
78
+	{
79
+		$error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')];
80
+		abort($error['status'], $error['message']);
81
+	}
82
+
83
+	public function emailAlreadyConfirmed()
84
+	{
85
+		$error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')];
86
+		abort($error['status'], $error['message']);
87
+	}
88
+
89
+	public function invalidResetToken()
90
+	{
91
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')];
92
+		abort($error['status'], $error['message']);
93
+	}
94
+
95
+	public function invalidResetPassword()
96
+	{
97
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')];
98
+		abort($error['status'], $error['message']);
99
+	}
100
+
101
+	public function invalidOldPassword()
102
+	{
103
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')];
104
+		abort($error['status'], $error['message']);
105
+	}
106
+
107
+	public function notFound($text)
108
+	{
109
+		$error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])];
110
+		abort($error['status'], $error['message']);
111
+	}
112
+
113
+	public function generalError()
114
+	{
115
+		$error = ['status' => 400, 'message' => trans('core::errors.generalError')];
116
+		abort($error['status'], $error['message']);
117
+	}
118 118
 }
119 119
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/Acl/ModelObservers/AclUserObserver.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -5,63 +5,63 @@
 block discarded – undo
5 5
  */
6 6
 class AclUserObserver {
7 7
 
8
-    public function saving($model)
9
-    {
10
-        //
11
-    }
8
+	public function saving($model)
9
+	{
10
+		//
11
+	}
12 12
 
13
-    public function saved($model)
14
-    {
15
-        //
16
-    }
13
+	public function saved($model)
14
+	{
15
+		//
16
+	}
17 17
 
18
-    public function creating($model)
19
-    {
20
-        //
21
-    }
18
+	public function creating($model)
19
+	{
20
+		//
21
+	}
22 22
 
23
-    public function created($model)
24
-    {
25
-        //
26
-    }
23
+	public function created($model)
24
+	{
25
+		//
26
+	}
27 27
 
28
-    public function updating($model)
29
-    {
30
-        //
31
-    }
28
+	public function updating($model)
29
+	{
30
+		//
31
+	}
32 32
 
33
-    public function updated($model)
34
-    {
35
-        if ($model->isDirty('blocked') && $model->blocked) 
36
-        {
37
-            $model->tokens()->each(function($token){
33
+	public function updated($model)
34
+	{
35
+		if ($model->isDirty('blocked') && $model->blocked) 
36
+		{
37
+			$model->tokens()->each(function($token){
38 38
 
39
-                \Core::users()->revokeAccessToken($token);
39
+				\Core::users()->revokeAccessToken($token);
40 40
 
41
-            });
42
-        }
43
-    }
41
+			});
42
+		}
43
+	}
44 44
 
45
-    public function deleting($model)
46
-    {
47
-        if ($model->getOriginal('id') == \Auth::id()) 
48
-        {
49
-            \ErrorHandler::noPermissions();
50
-        }
51
-    }
45
+	public function deleting($model)
46
+	{
47
+		if ($model->getOriginal('id') == \Auth::id()) 
48
+		{
49
+			\ErrorHandler::noPermissions();
50
+		}
51
+	}
52 52
 
53
-    public function deleted($model)
54
-    {
55
-        //
56
-    }
53
+	public function deleted($model)
54
+	{
55
+		//
56
+	}
57 57
 
58
-    public function restoring($model)
59
-    {
60
-        //
61
-    }
58
+	public function restoring($model)
59
+	{
60
+		//
61
+	}
62 62
 
63
-    public function restored($model)
64
-    {
65
-        //
66
-    }
63
+	public function restored($model)
64
+	{
65
+		//
66
+	}
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     {
35 35
         if ($model->isDirty('blocked') && $model->blocked) 
36 36
         {
37
-            $model->tokens()->each(function($token){
37
+            $model->tokens()->each(function($token) {
38 38
 
39 39
                 \Core::users()->revokeAccessToken($token);
40 40
 
Please login to merge, or discard this patch.
src/Modules/Acl/Proxy/LoginProxy.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -5,95 +5,95 @@
 block discarded – undo
5 5
 
6 6
 class LoginProxy
7 7
 {
8
-    private $apiConsumer;
9
-
10
-    private $auth;
11
-
12
-    private $request;
13
-
14
-    private $userRepository;
15
-
16
-    public function __construct(Application $app) 
17
-    {
18
-
19
-        $this->userRepository = $app->make('App\Modules\Acl\Repositories\UserRepository');
20
-        $this->apiConsumer    = $app->make('apiconsumer');
21
-        $this->auth           = $app->make('auth');
22
-        $this->request        = $app->make('request');
23
-    }
24
-
25
-    /**
26
-     * Attempt to create an access token using user credentials.
27
-     *
28
-     * @param  array   $credentials
29
-     * @param  boolean $adminLogin
30
-     * @return array
31
-     */
32
-    public function login($credentials, $adminLogin = false)
33
-    {
34
-        $this->userRepository->login($credentials, $adminLogin);
35
-
36
-        return $this->proxy('password', [
37
-            'username' => $credentials['email'],
38
-            'password' => $credentials['password']
39
-        ]);
40
-    }
41
-
42
-    /**
43
-     * Attempt to refresh the access token useing the given refresh token.
44
-     * 
45
-     * @param  string $refreshToken
46
-     * @return array
47
-     */
48
-    public function refreshtoken($refreshToken)
49
-    {
50
-        return $this->proxy('refresh_token', [
51
-            'refresh_token' => $refreshToken
52
-        ]);
53
-    }
54
-
55
-    /**
56
-     * Proxy a request to the OAuth server.
57
-     *
58
-     * @param string $grantType what type of grant type should be proxied
59
-     * @param array 
60
-     */
61
-    public function proxy($grantType, array $data = [])
62
-    {
63
-        $data = array_merge($data, [
64
-            'client_id'     => config('skeleton.passport_client_id'),
65
-            'client_secret' => config('skeleton.passport_client_secret'),
66
-            'grant_type'    => $grantType
67
-        ]);
68
-
69
-        $response = $this->apiConsumer->post('/oauth/token', $data);
70
-
71
-        if ( ! $response->isSuccessful()) 
72
-        {
73
-            if ($grantType == 'refresh_token') 
74
-            {
75
-                \ErrorHandler::invalidRefreshToken();
76
-            }
77
-
78
-            \ErrorHandler::loginFailed();
79
-        }
80
-
81
-        $data = json_decode($response->getContent());
82
-
83
-        return [
84
-            'access_token'  => $data->access_token,
85
-            'refresh_token' => $data->refresh_token,
86
-            'expires_in'    => $data->expires_in
87
-        ];
88
-    }
89
-
90
-    /**
91
-     * Logs out the user. We revoke access token and refresh token.
92
-     * 
93
-     * @return void
94
-     */
95
-    public function logout()
96
-    {
97
-        \Core::users()->revokeAccessToken($this->auth->user()->token());
98
-    }
8
+	private $apiConsumer;
9
+
10
+	private $auth;
11
+
12
+	private $request;
13
+
14
+	private $userRepository;
15
+
16
+	public function __construct(Application $app) 
17
+	{
18
+
19
+		$this->userRepository = $app->make('App\Modules\Acl\Repositories\UserRepository');
20
+		$this->apiConsumer    = $app->make('apiconsumer');
21
+		$this->auth           = $app->make('auth');
22
+		$this->request        = $app->make('request');
23
+	}
24
+
25
+	/**
26
+	 * Attempt to create an access token using user credentials.
27
+	 *
28
+	 * @param  array   $credentials
29
+	 * @param  boolean $adminLogin
30
+	 * @return array
31
+	 */
32
+	public function login($credentials, $adminLogin = false)
33
+	{
34
+		$this->userRepository->login($credentials, $adminLogin);
35
+
36
+		return $this->proxy('password', [
37
+			'username' => $credentials['email'],
38
+			'password' => $credentials['password']
39
+		]);
40
+	}
41
+
42
+	/**
43
+	 * Attempt to refresh the access token useing the given refresh token.
44
+	 * 
45
+	 * @param  string $refreshToken
46
+	 * @return array
47
+	 */
48
+	public function refreshtoken($refreshToken)
49
+	{
50
+		return $this->proxy('refresh_token', [
51
+			'refresh_token' => $refreshToken
52
+		]);
53
+	}
54
+
55
+	/**
56
+	 * Proxy a request to the OAuth server.
57
+	 *
58
+	 * @param string $grantType what type of grant type should be proxied
59
+	 * @param array 
60
+	 */
61
+	public function proxy($grantType, array $data = [])
62
+	{
63
+		$data = array_merge($data, [
64
+			'client_id'     => config('skeleton.passport_client_id'),
65
+			'client_secret' => config('skeleton.passport_client_secret'),
66
+			'grant_type'    => $grantType
67
+		]);
68
+
69
+		$response = $this->apiConsumer->post('/oauth/token', $data);
70
+
71
+		if ( ! $response->isSuccessful()) 
72
+		{
73
+			if ($grantType == 'refresh_token') 
74
+			{
75
+				\ErrorHandler::invalidRefreshToken();
76
+			}
77
+
78
+			\ErrorHandler::loginFailed();
79
+		}
80
+
81
+		$data = json_decode($response->getContent());
82
+
83
+		return [
84
+			'access_token'  => $data->access_token,
85
+			'refresh_token' => $data->refresh_token,
86
+			'expires_in'    => $data->expires_in
87
+		];
88
+	}
89
+
90
+	/**
91
+	 * Logs out the user. We revoke access token and refresh token.
92
+	 * 
93
+	 * @return void
94
+	 */
95
+	public function logout()
96
+	{
97
+		\Core::users()->revokeAccessToken($this->auth->user()->token());
98
+	}
99 99
 }
100 100
\ No newline at end of file
Please login to merge, or discard this patch.