Completed
Push — master ( 7a7a2b...9a7d30 )
by Sherif
36s
created
src/Modules/OauthClients/Providers/ModuleServiceProvider.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,35 +10,35 @@
 block discarded – undo
10 10
 
11 11
 class ModuleServiceProvider extends ServiceProvider
12 12
 {
13
-    /**
14
-     * Bootstrap the module services.
15
-     *
16
-     * @return void
17
-     */
18
-    public function boot()
19
-    {
20
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients');
21
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients');
13
+	/**
14
+	 * Bootstrap the module services.
15
+	 *
16
+	 * @return void
17
+	 */
18
+	public function boot()
19
+	{
20
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'oauth-clients');
21
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'oauth-clients');
22 22
 
23
-        $this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
24
-        if (!$this->app->configurationIsCached()) {
25
-            $this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
26
-        }
27
-    }
23
+		$this->loadMigrationsFrom(module_path('oauth-clients', 'Database/Migrations', 'app'));
24
+		if (!$this->app->configurationIsCached()) {
25
+			$this->loadConfigsFrom(module_path('oauth-clients', 'Config', 'app'));
26
+		}
27
+	}
28 28
 
29
-    /**
30
-     * Register the module services.
31
-     *
32
-     * @return void
33
-     */
34
-    public function register()
35
-    {
36
-        $this->app->register(RouteServiceProvider::class);
29
+	/**
30
+	 * Register the module services.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function register()
35
+	{
36
+		$this->app->register(RouteServiceProvider::class);
37 37
 
38
-        /**
39
-         * Bind interfaces to implmentations.
40
-         */
41
-        $this->app->bind(OauthClientServiceInterface::class, OauthClientService::class);
42
-        $this->app->bind(OauthClientRepositoryInterface::class, OauthClientRepository::class);
43
-    }
38
+		/**
39
+		 * Bind interfaces to implmentations.
40
+		 */
41
+		$this->app->bind(OauthClientServiceInterface::class, OauthClientService::class);
42
+		$this->app->bind(OauthClientRepositoryInterface::class, OauthClientRepository::class);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Repositories/NotificationRepository.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -9,63 +9,63 @@
 block discarded – undo
9 9
 
10 10
 class NotificationRepository extends BaseRepository implements NotificationRepositoryInterface
11 11
 {
12
-    /**
13
-     * Init new object.
14
-     *
15
-     * @param   Notification $model
16
-     * @return  void
17
-     */
18
-    public function __construct(Notification $model)
19
-    {
20
-        parent::__construct($model);
21
-    }
12
+	/**
13
+	 * Init new object.
14
+	 *
15
+	 * @param   Notification $model
16
+	 * @return  void
17
+	 */
18
+	public function __construct(Notification $model)
19
+	{
20
+		parent::__construct($model);
21
+	}
22 22
 
23
-    /**
24
-     * Retrieve all notifications of the logged in user.
25
-     *
26
-     * @param  int $perPage
27
-     * @return LengthAwarePaginator
28
-     */
29
-    public function my(int $perPage): LengthAwarePaginator
30
-    {
31
-        return Auth::user()->notifications()->paginate($perPage);
32
-    }
23
+	/**
24
+	 * Retrieve all notifications of the logged in user.
25
+	 *
26
+	 * @param  int $perPage
27
+	 * @return LengthAwarePaginator
28
+	 */
29
+	public function my(int $perPage): LengthAwarePaginator
30
+	{
31
+		return Auth::user()->notifications()->paginate($perPage);
32
+	}
33 33
 
34
-    /**
35
-     * Retrieve unread notifications of the logged in user.
36
-     *
37
-     * @param  int $perPage
38
-     * @return LengthAwarePaginator
39
-     */
40
-    public function unread(int $perPage): LengthAwarePaginator
41
-    {
42
-        return Auth::user()->unreadNotifications()->paginate($perPage);
43
-    }
34
+	/**
35
+	 * Retrieve unread notifications of the logged in user.
36
+	 *
37
+	 * @param  int $perPage
38
+	 * @return LengthAwarePaginator
39
+	 */
40
+	public function unread(int $perPage): LengthAwarePaginator
41
+	{
42
+		return Auth::user()->unreadNotifications()->paginate($perPage);
43
+	}
44 44
 
45
-    /**
46
-     * Mark the notification as read.
47
-     *
48
-     * @param  int  $id
49
-     * @return bool
50
-     */
51
-    public function markAsRead(int $id): bool
52
-    {
53
-        if ($notification = Auth::user()->unreadNotifications()->where('id', $id)->first()) {
54
-            $notification->markAsRead();
55
-        }
45
+	/**
46
+	 * Mark the notification as read.
47
+	 *
48
+	 * @param  int  $id
49
+	 * @return bool
50
+	 */
51
+	public function markAsRead(int $id): bool
52
+	{
53
+		if ($notification = Auth::user()->unreadNotifications()->where('id', $id)->first()) {
54
+			$notification->markAsRead();
55
+		}
56 56
 
57
-        return true;
58
-    }
57
+		return true;
58
+	}
59 59
 
60
-    /**
61
-     * Mark all notifications as read.
62
-     *
63
-     * @return bool
64
-     */
65
-    public function markAllAsRead(): bool
66
-    {
67
-        Auth::user()->unreadNotifications()->update(['read_at' => now()]);
60
+	/**
61
+	 * Mark all notifications as read.
62
+	 *
63
+	 * @return bool
64
+	 */
65
+	public function markAllAsRead(): bool
66
+	{
67
+		Auth::user()->unreadNotifications()->update(['read_at' => now()]);
68 68
 
69
-        return true;
70
-    }
69
+		return true;
70
+	}
71 71
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Repositories/NotificationRepositoryInterface.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,34 +7,34 @@
 block discarded – undo
7 7
 
8 8
 interface NotificationRepositoryInterface extends BaseRepositoryInterface
9 9
 {
10
-    /**
11
-     * Retrieve all notifications of the logged in user.
12
-     *
13
-     * @param  int $perPage
14
-     * @return LengthAwarePaginator
15
-     */
16
-    public function my(int $perPage): LengthAwarePaginator;
10
+	/**
11
+	 * Retrieve all notifications of the logged in user.
12
+	 *
13
+	 * @param  int $perPage
14
+	 * @return LengthAwarePaginator
15
+	 */
16
+	public function my(int $perPage): LengthAwarePaginator;
17 17
 
18
-    /**
19
-     * Retrieve unread notifications of the logged in user.
20
-     *
21
-     * @param  int $perPage
22
-     * @return LengthAwarePaginator
23
-     */
24
-    public function unread(int $perPage): LengthAwarePaginator;
18
+	/**
19
+	 * Retrieve unread notifications of the logged in user.
20
+	 *
21
+	 * @param  int $perPage
22
+	 * @return LengthAwarePaginator
23
+	 */
24
+	public function unread(int $perPage): LengthAwarePaginator;
25 25
 
26
-    /**
27
-     * Mark the notification as read.
28
-     *
29
-     * @param  int  $id
30
-     * @return bool
31
-     */
32
-    public function markAsRead(int $id): bool;
26
+	/**
27
+	 * Mark the notification as read.
28
+	 *
29
+	 * @param  int  $id
30
+	 * @return bool
31
+	 */
32
+	public function markAsRead(int $id): bool;
33 33
 
34
-    /**
35
-     * Mark all notifications as read.
36
-     *
37
-     * @return bool
38
-     */
39
-    public function markAllAsRead(): bool;
34
+	/**
35
+	 * Mark all notifications as read.
36
+	 *
37
+	 * @return bool
38
+	 */
39
+	public function markAllAsRead(): bool;
40 40
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Http/Controllers/NotificationController.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -9,71 +9,71 @@
 block discarded – undo
9 9
 
10 10
 class NotificationController extends BaseApiController
11 11
 {
12
-    /**
13
-     * Path of the model resource
14
-     *
15
-     * @var string
16
-     */
17
-    protected $modelResource = 'App\Modules\Notifications\Http\Resources\Notification';
12
+	/**
13
+	 * Path of the model resource
14
+	 *
15
+	 * @var string
16
+	 */
17
+	protected $modelResource = 'App\Modules\Notifications\Http\Resources\Notification';
18 18
 
19
-    /**
20
-     * List of all route actions that the base api controller
21
-     * will skip permissions check for them.
22
-     * @var array
23
-     */
24
-    protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'index', 'unread'];
19
+	/**
20
+	 * List of all route actions that the base api controller
21
+	 * will skip permissions check for them.
22
+	 * @var array
23
+	 */
24
+	protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'index', 'unread'];
25 25
 
26
-    /**
27
-     * Init new object.
28
-     *
29
-     * @param   NotificationServiceInterface $service
30
-     * @return  void
31
-     */
32
-    public function __construct(NotificationServiceInterface $service)
33
-    {
34
-        parent::__construct($service);
35
-    }
26
+	/**
27
+	 * Init new object.
28
+	 *
29
+	 * @param   NotificationServiceInterface $service
30
+	 * @return  void
31
+	 */
32
+	public function __construct(NotificationServiceInterface $service)
33
+	{
34
+		parent::__construct($service);
35
+	}
36 36
 
37
-    /**
38
-     * Retrieve all notifications of the logged in user.
39
-     *
40
-     * @param Request $request
41
-     * @return \Illuminate\Http\Response
42
-     */
43
-    public function index(Request $request)
44
-    {
45
-        return $this->modelResource::collection($this->service->my($request->query('perPage')));
46
-    }
37
+	/**
38
+	 * Retrieve all notifications of the logged in user.
39
+	 *
40
+	 * @param Request $request
41
+	 * @return \Illuminate\Http\Response
42
+	 */
43
+	public function index(Request $request)
44
+	{
45
+		return $this->modelResource::collection($this->service->my($request->query('perPage')));
46
+	}
47 47
 
48
-    /**
49
-     * Retrieve unread notifications of the logged in user.
50
-     *
51
-     * @param Request $request
52
-     * @return \Illuminate\Http\Response
53
-     */
54
-    public function unread(Request $request)
55
-    {
56
-        return $this->modelResource::collection($this->service->unread($request->query('perPage')));
57
-    }
48
+	/**
49
+	 * Retrieve unread notifications of the logged in user.
50
+	 *
51
+	 * @param Request $request
52
+	 * @return \Illuminate\Http\Response
53
+	 */
54
+	public function unread(Request $request)
55
+	{
56
+		return $this->modelResource::collection($this->service->unread($request->query('perPage')));
57
+	}
58 58
 
59
-    /**
60
-     * Mark the notification as read.
61
-     *
62
-     * @param  integer  $id Id of the notification.
63
-     * @return \Illuminate\Http\Response
64
-     */
65
-    public function markAsRead($id)
66
-    {
67
-        return new GeneralResource($this->service->markAsRead($id));
68
-    }
59
+	/**
60
+	 * Mark the notification as read.
61
+	 *
62
+	 * @param  integer  $id Id of the notification.
63
+	 * @return \Illuminate\Http\Response
64
+	 */
65
+	public function markAsRead($id)
66
+	{
67
+		return new GeneralResource($this->service->markAsRead($id));
68
+	}
69 69
 
70
-    /**
71
-     * Mark all notifications as read.
72
-     *
73
-     * @return \Illuminate\Http\Response
74
-     */
75
-    public function markAllAsRead()
76
-    {
77
-        return new GeneralResource($this->service->markAllAsRead());
78
-    }
70
+	/**
71
+	 * Mark all notifications as read.
72
+	 *
73
+	 * @return \Illuminate\Http\Response
74
+	 */
75
+	public function markAllAsRead()
76
+	{
77
+		return new GeneralResource($this->service->markAllAsRead());
78
+	}
79 79
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Services/NotificationServiceInterface.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -7,46 +7,46 @@
 block discarded – undo
7 7
 
8 8
 interface NotificationServiceInterface extends BaseServiceInterface
9 9
 {
10
-    /**
11
-     * Retrieve all notifications of the logged in user.
12
-     *
13
-     * @param  int $perPage
14
-     * @return LengthAwarePaginator
15
-     */
16
-    public function my(int $perPage): LengthAwarePaginator;
17
-
18
-
19
-    /**
20
-     * Retrieve unread notifications of the logged in user.
21
-     *
22
-     * @param  int $perPage
23
-     * @return LengthAwarePaginator
24
-     */
25
-    public function unread(int $perPage): LengthAwarePaginator;
26
-
27
-
28
-    /**
29
-     * Mark the notification as read.
30
-     *
31
-     * @param  int  $id
32
-     * @return bool
33
-     */
34
-    public function markAsRead(int $id): bool;
35
-
36
-    /**
37
-     * Mark all notifications as read.
38
-     *
39
-     * @return bool
40
-     */
41
-    public function markAllAsRead(): bool;
42
-
43
-    /**
44
-     * Notify th given user with the given notification.
45
-     *
46
-     * @param  mixed    $users
47
-     * @param  string   $notification
48
-     * @param  Variadic $notificationData
49
-     * @return void
50
-     */
51
-    public function notify(mixed $users, string $notification, ...$notificationData): bool;
10
+	/**
11
+	 * Retrieve all notifications of the logged in user.
12
+	 *
13
+	 * @param  int $perPage
14
+	 * @return LengthAwarePaginator
15
+	 */
16
+	public function my(int $perPage): LengthAwarePaginator;
17
+
18
+
19
+	/**
20
+	 * Retrieve unread notifications of the logged in user.
21
+	 *
22
+	 * @param  int $perPage
23
+	 * @return LengthAwarePaginator
24
+	 */
25
+	public function unread(int $perPage): LengthAwarePaginator;
26
+
27
+
28
+	/**
29
+	 * Mark the notification as read.
30
+	 *
31
+	 * @param  int  $id
32
+	 * @return bool
33
+	 */
34
+	public function markAsRead(int $id): bool;
35
+
36
+	/**
37
+	 * Mark all notifications as read.
38
+	 *
39
+	 * @return bool
40
+	 */
41
+	public function markAllAsRead(): bool;
42
+
43
+	/**
44
+	 * Notify th given user with the given notification.
45
+	 *
46
+	 * @param  mixed    $users
47
+	 * @param  string   $notification
48
+	 * @param  Variadic $notificationData
49
+	 * @return void
50
+	 */
51
+	public function notify(mixed $users, string $notification, ...$notificationData): bool;
52 52
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Services/NotificationService.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -10,80 +10,80 @@
 block discarded – undo
10 10
 
11 11
 class NotificationService extends BaseService implements NotificationServiceInterface
12 12
 {
13
-    /**
14
-     * @var UserRepositoryInterface
15
-     */
16
-    protected $userRepository;
13
+	/**
14
+	 * @var UserRepositoryInterface
15
+	 */
16
+	protected $userRepository;
17 17
 
18
-    /**
19
-     * Init new object.
20
-     *
21
-     * @param   NotificationServiceInterface $repo
22
-     * @return  void
23
-     */
24
-    public function __construct(NotificationRepositoryInterface $repo, UserRepositoryInterface $userRepository)
25
-    {
26
-        $this->userRepository = $userRepository;
27
-        parent::__construct($repo);
28
-    }
18
+	/**
19
+	 * Init new object.
20
+	 *
21
+	 * @param   NotificationServiceInterface $repo
22
+	 * @return  void
23
+	 */
24
+	public function __construct(NotificationRepositoryInterface $repo, UserRepositoryInterface $userRepository)
25
+	{
26
+		$this->userRepository = $userRepository;
27
+		parent::__construct($repo);
28
+	}
29 29
 
30
-    /**
31
-     * Retrieve all notifications of the logged in user.
32
-     *
33
-     * @param  int $perPage
34
-     * @return LengthAwarePaginator
35
-     */
36
-    public function my(int $perPage): LengthAwarePaginator
37
-    {
38
-        return $this->repo->my($perPage);
39
-    }
30
+	/**
31
+	 * Retrieve all notifications of the logged in user.
32
+	 *
33
+	 * @param  int $perPage
34
+	 * @return LengthAwarePaginator
35
+	 */
36
+	public function my(int $perPage): LengthAwarePaginator
37
+	{
38
+		return $this->repo->my($perPage);
39
+	}
40 40
 
41
-    /**
42
-     * Retrieve unread notifications of the logged in user.
43
-     *
44
-     * @param  int $perPage
45
-     * @return LengthAwarePaginator
46
-     */
47
-    public function unread(int $perPage): LengthAwarePaginator
48
-    {
49
-        return $this->repo->unread($perPage);
50
-    }
41
+	/**
42
+	 * Retrieve unread notifications of the logged in user.
43
+	 *
44
+	 * @param  int $perPage
45
+	 * @return LengthAwarePaginator
46
+	 */
47
+	public function unread(int $perPage): LengthAwarePaginator
48
+	{
49
+		return $this->repo->unread($perPage);
50
+	}
51 51
 
52
-    /**
53
-     * Mark the notification as read.
54
-     *
55
-     * @param  int  $id
56
-     * @return bool
57
-     */
58
-    public function markAsRead(int $id): bool
59
-    {
60
-        return $this->repo->markAsRead($id);
61
-    }
52
+	/**
53
+	 * Mark the notification as read.
54
+	 *
55
+	 * @param  int  $id
56
+	 * @return bool
57
+	 */
58
+	public function markAsRead(int $id): bool
59
+	{
60
+		return $this->repo->markAsRead($id);
61
+	}
62 62
 
63
-    /**
64
-     * Mark all notifications as read.
65
-     *
66
-     * @return bool
67
-     */
68
-    public function markAllAsRead(): bool
69
-    {
70
-        return $this->repo->markAllAsRead();
71
-    }
63
+	/**
64
+	 * Mark all notifications as read.
65
+	 *
66
+	 * @return bool
67
+	 */
68
+	public function markAllAsRead(): bool
69
+	{
70
+		return $this->repo->markAllAsRead();
71
+	}
72 72
 
73
-    /**
74
-     * Notify th given user with the given notification.
75
-     *
76
-     * @param  mixed    $users
77
-     * @param  string   $notification
78
-     * @param  Variadic $notificationData
79
-     * @return void
80
-     */
81
-    public function notify(mixed $users, string $notification, ...$notificationData): bool
82
-    {
83
-        $users = is_array($users) ? $this->userRepository->findBy(['id' => ['op' => 'in', 'val' => $users]]) : $users;
84
-        $notification = 'App\Modules\Notifications\Notifications\\'.$notification;
85
-        Notification::send($users, new $notification(...$notificationData));
73
+	/**
74
+	 * Notify th given user with the given notification.
75
+	 *
76
+	 * @param  mixed    $users
77
+	 * @param  string   $notification
78
+	 * @param  Variadic $notificationData
79
+	 * @return void
80
+	 */
81
+	public function notify(mixed $users, string $notification, ...$notificationData): bool
82
+	{
83
+		$users = is_array($users) ? $this->userRepository->findBy(['id' => ['op' => 'in', 'val' => $users]]) : $users;
84
+		$notification = 'App\Modules\Notifications\Notifications\\'.$notification;
85
+		Notification::send($users, new $notification(...$notificationData));
86 86
 
87
-        return true;
88
-    }
87
+		return true;
88
+	}
89 89
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Providers/ModuleServiceProvider.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,35 +10,35 @@
 block discarded – undo
10 10
 
11 11
 class ModuleServiceProvider extends ServiceProvider
12 12
 {
13
-    /**
14
-     * Bootstrap the module services.
15
-     *
16
-     * @return void
17
-     */
18
-    public function boot()
19
-    {
20
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'notifications');
21
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'notifications');
13
+	/**
14
+	 * Bootstrap the module services.
15
+	 *
16
+	 * @return void
17
+	 */
18
+	public function boot()
19
+	{
20
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'notifications');
21
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'notifications');
22 22
 
23
-        $this->loadMigrationsFrom(module_path('notifications', 'Database/Migrations', 'app'));
24
-        if (!$this->app->configurationIsCached()) {
25
-            $this->loadConfigsFrom(module_path('notifications', 'Config', 'app'));
26
-        }
27
-    }
23
+		$this->loadMigrationsFrom(module_path('notifications', 'Database/Migrations', 'app'));
24
+		if (!$this->app->configurationIsCached()) {
25
+			$this->loadConfigsFrom(module_path('notifications', 'Config', 'app'));
26
+		}
27
+	}
28 28
 
29
-    /**
30
-     * Register the module services.
31
-     *
32
-     * @return void
33
-     */
34
-    public function register()
35
-    {
36
-        $this->app->register(RouteServiceProvider::class);
29
+	/**
30
+	 * Register the module services.
31
+	 *
32
+	 * @return void
33
+	 */
34
+	public function register()
35
+	{
36
+		$this->app->register(RouteServiceProvider::class);
37 37
 
38
-        /**
39
-         * Bind interfaces to implmentations.
40
-         */
41
-        $this->app->bind(NotificationServiceInterface::class, NotificationService::class);
42
-        $this->app->bind(NotificationRepositoryInterface::class, NotificationRepository::class);
43
-    }
38
+		/**
39
+		 * Bind interfaces to implmentations.
40
+		 */
41
+		$this->app->bind(NotificationServiceInterface::class, NotificationService::class);
42
+		$this->app->bind(NotificationRepositoryInterface::class, NotificationRepository::class);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
src/Modules/Users/Repositories/UserRepositoryInterface.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@
 block discarded – undo
7 7
 interface UserRepositoryInterface extends BaseRepositoryInterface
8 8
 {
9 9
 
10
-    /**
11
-     * Detach all roles from the given user.
12
-     *
13
-     * @param  mixed $user
14
-     * @return bool
15
-     */
16
-    public function detachRoles(mixed $user): bool;
10
+	/**
11
+	 * Detach all roles from the given user.
12
+	 *
13
+	 * @param  mixed $user
14
+	 * @return bool
15
+	 */
16
+	public function detachRoles(mixed $user): bool;
17 17
 
18
-    /**
19
-     * Attach role ids to the given user.
20
-     *
21
-     * @param  mixed $user
22
-     * @param  array $roleIds
23
-     * @return bool
24
-     */
25
-    public function attachRoles(mixed $user, array $roleIds): bool;
18
+	/**
19
+	 * Attach role ids to the given user.
20
+	 *
21
+	 * @param  mixed $user
22
+	 * @param  array $roleIds
23
+	 * @return bool
24
+	 */
25
+	public function attachRoles(mixed $user, array $roleIds): bool;
26 26
 
27
-    /**
28
-     * Count the given user the given roles.
29
-     *
30
-     * @param  mixed $user
31
-     * @param  array $roles
32
-     * @return int
33
-     */
34
-    public function countRoles(mixed $user, array $roles): int;
27
+	/**
28
+	 * Count the given user the given roles.
29
+	 *
30
+	 * @param  mixed $user
31
+	 * @param  array $roles
32
+	 * @return int
33
+	 */
34
+	public function countRoles(mixed $user, array $roles): int;
35 35
 }
Please login to merge, or discard this patch.
src/Modules/Users/Repositories/UserRepository.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -7,56 +7,56 @@
 block discarded – undo
7 7
 
8 8
 class UserRepository extends BaseRepository implements UserRepositoryInterface
9 9
 {
10
-    /**
11
-     * Init new object.
12
-     *
13
-     * @param   AclUser $model
14
-     * @return  void
15
-     */
16
-    public function __construct(AclUser $model)
17
-    {
18
-        parent::__construct($model);
19
-    }
20
-
21
-    /**
22
-     * Detach all roles from the given user.
23
-     *
24
-     * @param  mixed $user
25
-     * @return bool
26
-     */
27
-    public function detachRoles(mixed $user): bool
28
-    {
29
-        $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
30
-        $user->roles()->detach();
31
-
32
-        return true;
33
-    }
34
-
35
-    /**
36
-     * Attach role ids to the given user.
37
-     *
38
-     * @param  mixed $user
39
-     * @param  array $roleIds
40
-     * @return bool
41
-     */
42
-    public function attachRoles(mixed $user, array $roleIds): bool
43
-    {
44
-        $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
45
-        $user->roles()->attach($roleIds);
46
-
47
-        return true;
48
-    }
49
-
50
-    /**
51
-     * Count the given user the given roles.
52
-     *
53
-     * @param  mixed $user
54
-     * @param  array $roles
55
-     * @return int
56
-     */
57
-    public function countRoles(mixed $user, array $roles): int
58
-    {
59
-        $user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
60
-        return $user->roles()->whereIn('name', $roles)->count();
61
-    }
10
+	/**
11
+	 * Init new object.
12
+	 *
13
+	 * @param   AclUser $model
14
+	 * @return  void
15
+	 */
16
+	public function __construct(AclUser $model)
17
+	{
18
+		parent::__construct($model);
19
+	}
20
+
21
+	/**
22
+	 * Detach all roles from the given user.
23
+	 *
24
+	 * @param  mixed $user
25
+	 * @return bool
26
+	 */
27
+	public function detachRoles(mixed $user): bool
28
+	{
29
+		$user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
30
+		$user->roles()->detach();
31
+
32
+		return true;
33
+	}
34
+
35
+	/**
36
+	 * Attach role ids to the given user.
37
+	 *
38
+	 * @param  mixed $user
39
+	 * @param  array $roleIds
40
+	 * @return bool
41
+	 */
42
+	public function attachRoles(mixed $user, array $roleIds): bool
43
+	{
44
+		$user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
45
+		$user->roles()->attach($roleIds);
46
+
47
+		return true;
48
+	}
49
+
50
+	/**
51
+	 * Count the given user the given roles.
52
+	 *
53
+	 * @param  mixed $user
54
+	 * @param  array $roles
55
+	 * @return int
56
+	 */
57
+	public function countRoles(mixed $user, array $roles): int
58
+	{
59
+		$user = ! filter_var($user, FILTER_VALIDATE_INT) ? $user : $this->find($user);
60
+		return $user->roles()->whereIn('name', $roles)->count();
61
+	}
62 62
 }
Please login to merge, or discard this patch.