@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function toArray($request) |
19 | 19 | { |
20 | - if (! $this->resource) { |
|
20 | + if ( ! $this->resource) { |
|
21 | 21 | return []; |
22 | 22 | } |
23 | 23 |
@@ -9,32 +9,32 @@ |
||
9 | 9 | |
10 | 10 | class AclUser extends JsonResource |
11 | 11 | { |
12 | - /** |
|
13 | - * Transform the resource into an array. |
|
14 | - * |
|
15 | - * @param Request $request |
|
16 | - * @return array |
|
17 | - */ |
|
18 | - public function toArray($request) |
|
19 | - { |
|
20 | - if (! $this->resource) { |
|
21 | - return []; |
|
22 | - } |
|
12 | + /** |
|
13 | + * Transform the resource into an array. |
|
14 | + * |
|
15 | + * @param Request $request |
|
16 | + * @return array |
|
17 | + */ |
|
18 | + public function toArray($request) |
|
19 | + { |
|
20 | + if (! $this->resource) { |
|
21 | + return []; |
|
22 | + } |
|
23 | 23 | |
24 | - return [ |
|
25 | - 'id' => $this->id, |
|
26 | - 'name' => $this->name, |
|
27 | - 'email' => $this->email, |
|
28 | - 'profilePicture' => $this->profile_picture ? url(\Storage::url($this->profile_picture)) : null, |
|
29 | - 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
30 | - 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
31 | - 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
32 | - 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
33 | - 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
34 | - 'locale' => $this->locale, |
|
35 | - 'timezone' => $this->timezone, |
|
36 | - 'created_at' => $this->created_at, |
|
37 | - 'updated_at' => $this->updated_at, |
|
38 | - ]; |
|
39 | - } |
|
24 | + return [ |
|
25 | + 'id' => $this->id, |
|
26 | + 'name' => $this->name, |
|
27 | + 'email' => $this->email, |
|
28 | + 'profilePicture' => $this->profile_picture ? url(\Storage::url($this->profile_picture)) : null, |
|
29 | + 'notifications' => NotificationResource::collection($this->whenLoaded('notifications')), |
|
30 | + 'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')), |
|
31 | + 'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')), |
|
32 | + 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
33 | + 'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')), |
|
34 | + 'locale' => $this->locale, |
|
35 | + 'timezone' => $this->timezone, |
|
36 | + 'created_at' => $this->created_at, |
|
37 | + 'updated_at' => $this->updated_at, |
|
38 | + ]; |
|
39 | + } |
|
40 | 40 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class LoginSocial extends FormRequest |
8 | 8 | { |
9 | - /** |
|
10 | - * Determine if the user is authorized to make this request. |
|
11 | - * |
|
12 | - * @return bool |
|
13 | - */ |
|
14 | - public function authorize() |
|
15 | - { |
|
16 | - return true; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Determine if the user is authorized to make this request. |
|
11 | + * |
|
12 | + * @return bool |
|
13 | + */ |
|
14 | + public function authorize() |
|
15 | + { |
|
16 | + return true; |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Get the validation rules that apply to the request. |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function rules() |
|
25 | - { |
|
26 | - return [ |
|
27 | - 'auth_code' => 'required_without:access_token', |
|
28 | - 'access_token' => 'required_without:auth_code', |
|
29 | - 'type' => 'required|in:facebook,google' |
|
30 | - ]; |
|
31 | - } |
|
19 | + /** |
|
20 | + * Get the validation rules that apply to the request. |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function rules() |
|
25 | + { |
|
26 | + return [ |
|
27 | + 'auth_code' => 'required_without:access_token', |
|
28 | + 'access_token' => 'required_without:auth_code', |
|
29 | + 'type' => 'required|in:facebook,google' |
|
30 | + ]; |
|
31 | + } |
|
32 | 32 | } |
@@ -9,43 +9,43 @@ |
||
9 | 9 | |
10 | 10 | class ResetPassword extends Notification implements ShouldQueue |
11 | 11 | { |
12 | - use Queueable; |
|
12 | + use Queueable; |
|
13 | 13 | |
14 | - protected $token; |
|
14 | + protected $token; |
|
15 | 15 | |
16 | - /** |
|
17 | - * Init new object. |
|
18 | - * |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function __construct($token) |
|
22 | - { |
|
23 | - $this->token = $token; |
|
24 | - } |
|
16 | + /** |
|
17 | + * Init new object. |
|
18 | + * |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function __construct($token) |
|
22 | + { |
|
23 | + $this->token = $token; |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Get the notification's delivery channels. |
|
28 | - * |
|
29 | - * @param mixed $notifiable |
|
30 | - * @return string[] |
|
31 | - */ |
|
32 | - public function via($notifiable) |
|
33 | - { |
|
34 | - return ['mail']; |
|
35 | - } |
|
26 | + /** |
|
27 | + * Get the notification's delivery channels. |
|
28 | + * |
|
29 | + * @param mixed $notifiable |
|
30 | + * @return string[] |
|
31 | + */ |
|
32 | + public function via($notifiable) |
|
33 | + { |
|
34 | + return ['mail']; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Get the mail representation of the notification. |
|
39 | - * |
|
40 | - * @param mixed $notifiable |
|
41 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
42 | - */ |
|
43 | - public function toMail($notifiable) |
|
44 | - { |
|
45 | - return (new MailMessage) |
|
46 | - ->subject('Reset passowrd') |
|
47 | - ->line('Reset passowrd') |
|
48 | - ->line('To reset your password click on the button below') |
|
49 | - ->action('Reset password', config('user.reset_password_url').'/'.$this->token); |
|
50 | - } |
|
37 | + /** |
|
38 | + * Get the mail representation of the notification. |
|
39 | + * |
|
40 | + * @param mixed $notifiable |
|
41 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
42 | + */ |
|
43 | + public function toMail($notifiable) |
|
44 | + { |
|
45 | + return (new MailMessage) |
|
46 | + ->subject('Reset passowrd') |
|
47 | + ->line('Reset passowrd') |
|
48 | + ->line('To reset your password click on the button below') |
|
49 | + ->action('Reset password', config('user.reset_password_url').'/'.$this->token); |
|
50 | + } |
|
51 | 51 | } |
@@ -9,41 +9,41 @@ |
||
9 | 9 | |
10 | 10 | class ConfirmEmail extends Notification implements ShouldQueue |
11 | 11 | { |
12 | - use Queueable; |
|
12 | + use Queueable; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Init new object. |
|
16 | - * |
|
17 | - * @return void |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - // |
|
22 | - } |
|
14 | + /** |
|
15 | + * Init new object. |
|
16 | + * |
|
17 | + * @return void |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + // |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Get the notification's delivery channels. |
|
26 | - * |
|
27 | - * @param mixed $notifiable |
|
28 | - * @return string[] |
|
29 | - */ |
|
30 | - public function via($notifiable) |
|
31 | - { |
|
32 | - return ['mail']; |
|
33 | - } |
|
24 | + /** |
|
25 | + * Get the notification's delivery channels. |
|
26 | + * |
|
27 | + * @param mixed $notifiable |
|
28 | + * @return string[] |
|
29 | + */ |
|
30 | + public function via($notifiable) |
|
31 | + { |
|
32 | + return ['mail']; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Get the mail representation of the notification. |
|
37 | - * |
|
38 | - * @param mixed $notifiable |
|
39 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
40 | - */ |
|
41 | - public function toMail($notifiable) |
|
42 | - { |
|
43 | - return (new MailMessage) |
|
44 | - ->subject('Email verification') |
|
45 | - ->line('Email verification') |
|
46 | - ->line('To validate your email click on the button below') |
|
47 | - ->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code); |
|
48 | - } |
|
35 | + /** |
|
36 | + * Get the mail representation of the notification. |
|
37 | + * |
|
38 | + * @param mixed $notifiable |
|
39 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
40 | + */ |
|
41 | + public function toMail($notifiable) |
|
42 | + { |
|
43 | + return (new MailMessage) |
|
44 | + ->subject('Email verification') |
|
45 | + ->line('Email verification') |
|
46 | + ->line('To validate your email click on the button below') |
|
47 | + ->action('Verify your email', config('user.confrim_email_url').'/'.$notifiable->confirmation_code); |
|
48 | + } |
|
49 | 49 | } |
@@ -6,14 +6,14 @@ |
||
6 | 6 | |
7 | 7 | interface ReportRepositoryInterface extends BaseRepositoryInterface |
8 | 8 | { |
9 | - /** |
|
10 | - * Render the given report db view based on the given |
|
11 | - * condition. |
|
12 | - * |
|
13 | - * @param mixed $report |
|
14 | - * @param array $conditions |
|
15 | - * @param int $perPage |
|
16 | - * @return mixed |
|
17 | - */ |
|
18 | - public function renderReport(mixed $report, array $conditions = [], int $perPage = 0): mixed; |
|
9 | + /** |
|
10 | + * Render the given report db view based on the given |
|
11 | + * condition. |
|
12 | + * |
|
13 | + * @param mixed $report |
|
14 | + * @param array $conditions |
|
15 | + * @param int $perPage |
|
16 | + * @return mixed |
|
17 | + */ |
|
18 | + public function renderReport(mixed $report, array $conditions = [], int $perPage = 0): mixed; |
|
19 | 19 | } |
@@ -8,45 +8,45 @@ |
||
8 | 8 | |
9 | 9 | class ReportRepository extends BaseRepository implements ReportRepositoryInterface |
10 | 10 | { |
11 | - /** |
|
12 | - * Init new object. |
|
13 | - * |
|
14 | - * @param Report $model |
|
15 | - * @return void |
|
16 | - */ |
|
17 | - public function __construct(Report $model) |
|
18 | - { |
|
19 | - parent::__construct($model); |
|
20 | - } |
|
11 | + /** |
|
12 | + * Init new object. |
|
13 | + * |
|
14 | + * @param Report $model |
|
15 | + * @return void |
|
16 | + */ |
|
17 | + public function __construct(Report $model) |
|
18 | + { |
|
19 | + parent::__construct($model); |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * Render the given report db view based on the given |
|
24 | - * condition. |
|
25 | - * |
|
26 | - * @param mixed $report |
|
27 | - * @param array $conditions |
|
28 | - * @param int $perPage |
|
29 | - * @return mixed |
|
30 | - */ |
|
31 | - public function renderReport(mixed $report, array $conditions = [], int $perPage = 0): mixed |
|
32 | - { |
|
33 | - $report = ! filter_var($report, FILTER_VALIDATE_INT) ? $report : $this->find($report); |
|
34 | - /** |
|
35 | - * Fetch data from the report based on the given conditions. |
|
36 | - */ |
|
37 | - $report = DB::table($report->view_name); |
|
38 | - unset($conditions['page']); |
|
39 | - if (count($conditions)) { |
|
40 | - $conditions = $this->constructConditions($conditions, $this->model); |
|
41 | - $report->whereRaw($conditions['conditionString'], $conditions['conditionValues']); |
|
42 | - } |
|
43 | - /** |
|
44 | - * Paginate or all data. |
|
45 | - */ |
|
46 | - if ($perPage) { |
|
47 | - return $report->paginate($perPage); |
|
48 | - } else { |
|
49 | - return $report->get(); |
|
50 | - } |
|
51 | - } |
|
22 | + /** |
|
23 | + * Render the given report db view based on the given |
|
24 | + * condition. |
|
25 | + * |
|
26 | + * @param mixed $report |
|
27 | + * @param array $conditions |
|
28 | + * @param int $perPage |
|
29 | + * @return mixed |
|
30 | + */ |
|
31 | + public function renderReport(mixed $report, array $conditions = [], int $perPage = 0): mixed |
|
32 | + { |
|
33 | + $report = ! filter_var($report, FILTER_VALIDATE_INT) ? $report : $this->find($report); |
|
34 | + /** |
|
35 | + * Fetch data from the report based on the given conditions. |
|
36 | + */ |
|
37 | + $report = DB::table($report->view_name); |
|
38 | + unset($conditions['page']); |
|
39 | + if (count($conditions)) { |
|
40 | + $conditions = $this->constructConditions($conditions, $this->model); |
|
41 | + $report->whereRaw($conditions['conditionString'], $conditions['conditionValues']); |
|
42 | + } |
|
43 | + /** |
|
44 | + * Paginate or all data. |
|
45 | + */ |
|
46 | + if ($perPage) { |
|
47 | + return $report->paginate($perPage); |
|
48 | + } else { |
|
49 | + return $report->get(); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
@@ -9,40 +9,40 @@ |
||
9 | 9 | |
10 | 10 | class ReportController extends BaseApiController |
11 | 11 | { |
12 | - /** |
|
13 | - * Path of the model resource |
|
14 | - * |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $modelResource = 'App\Modules\Reporting\Http\Resources\Report'; |
|
12 | + /** |
|
13 | + * Path of the model resource |
|
14 | + * |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $modelResource = 'App\Modules\Reporting\Http\Resources\Report'; |
|
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 = ['getReport']; |
|
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 = ['getReport']; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Init new object. |
|
28 | - * |
|
29 | - * @param ReportServiceInterface $service |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function __construct(ReportServiceInterface $service) |
|
33 | - { |
|
34 | - parent::__construct($service); |
|
35 | - } |
|
26 | + /** |
|
27 | + * Init new object. |
|
28 | + * |
|
29 | + * @param ReportServiceInterface $service |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function __construct(ReportServiceInterface $service) |
|
33 | + { |
|
34 | + parent::__construct($service); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Render the given servicert name with the given conditions. |
|
39 | - * |
|
40 | - * @param Request $request |
|
41 | - * @param string $reportName Name of the requested servicert |
|
42 | - * @return \Illuminate\Http\Response |
|
43 | - */ |
|
44 | - public function getReport(Request $request, $reportName) |
|
45 | - { |
|
46 | - return new ViewResource($this->service->getReport($reportName, $request->all(), $request->query('perPage'))); |
|
47 | - } |
|
37 | + /** |
|
38 | + * Render the given servicert name with the given conditions. |
|
39 | + * |
|
40 | + * @param Request $request |
|
41 | + * @param string $reportName Name of the requested servicert |
|
42 | + * @return \Illuminate\Http\Response |
|
43 | + */ |
|
44 | + public function getReport(Request $request, $reportName) |
|
45 | + { |
|
46 | + return new ViewResource($this->service->getReport($reportName, $request->all(), $request->query('perPage'))); |
|
47 | + } |
|
48 | 48 | } |
@@ -9,50 +9,50 @@ |
||
9 | 9 | |
10 | 10 | class ReportService extends BaseService implements ReportServiceInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * @var UserServiceInterface |
|
14 | - */ |
|
15 | - protected $userService; |
|
12 | + /** |
|
13 | + * @var UserServiceInterface |
|
14 | + */ |
|
15 | + protected $userService; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Init new object. |
|
19 | - * |
|
20 | - * @param ReportRepositoryInterface $repo |
|
21 | - * @param UserServiceInterface $userService |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function __construct(ReportRepositoryInterface $repo, UserServiceInterface $userService) |
|
25 | - { |
|
26 | - $this->userService = $userService; |
|
27 | - parent::__construct($repo); |
|
28 | - } |
|
17 | + /** |
|
18 | + * Init new object. |
|
19 | + * |
|
20 | + * @param ReportRepositoryInterface $repo |
|
21 | + * @param UserServiceInterface $userService |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function __construct(ReportRepositoryInterface $repo, UserServiceInterface $userService) |
|
25 | + { |
|
26 | + $this->userService = $userService; |
|
27 | + parent::__construct($repo); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Render the given report db view based on the given |
|
32 | - * condition. |
|
33 | - * |
|
34 | - * @param string $reportName |
|
35 | - * @param array $conditions |
|
36 | - * @param integer $perPage |
|
37 | - * @param bool $skipPermission |
|
38 | - * @return mixed |
|
39 | - */ |
|
40 | - public function getReport(string $reportName, array $conditions = [], int $perPage = 0, bool $skipPermission = false): mixed |
|
41 | - { |
|
42 | - /** |
|
43 | - * Fetch the report from db. |
|
44 | - */ |
|
45 | - $report = $this->repo->first(['report_name' => $reportName]); |
|
30 | + /** |
|
31 | + * Render the given report db view based on the given |
|
32 | + * condition. |
|
33 | + * |
|
34 | + * @param string $reportName |
|
35 | + * @param array $conditions |
|
36 | + * @param integer $perPage |
|
37 | + * @param bool $skipPermission |
|
38 | + * @return mixed |
|
39 | + */ |
|
40 | + public function getReport(string $reportName, array $conditions = [], int $perPage = 0, bool $skipPermission = false): mixed |
|
41 | + { |
|
42 | + /** |
|
43 | + * Fetch the report from db. |
|
44 | + */ |
|
45 | + $report = $this->repo->first(['report_name' => $reportName]); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Check report existance and permission. |
|
49 | - */ |
|
50 | - if (! $report) { |
|
51 | - Errors::notFound('report'); |
|
52 | - } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
53 | - Errors::noPermissions(); |
|
54 | - } |
|
47 | + /** |
|
48 | + * Check report existance and permission. |
|
49 | + */ |
|
50 | + if (! $report) { |
|
51 | + Errors::notFound('report'); |
|
52 | + } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
53 | + Errors::noPermissions(); |
|
54 | + } |
|
55 | 55 | |
56 | - return $this->repo->renderReport($report, $conditions, $perPage); |
|
57 | - } |
|
56 | + return $this->repo->renderReport($report, $conditions, $perPage); |
|
57 | + } |
|
58 | 58 | } |
@@ -47,9 +47,9 @@ |
||
47 | 47 | /** |
48 | 48 | * Check report existance and permission. |
49 | 49 | */ |
50 | - if (! $report) { |
|
50 | + if ( ! $report) { |
|
51 | 51 | Errors::notFound('report'); |
52 | - } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
52 | + } elseif ( ! $skipPermission && ! $this->userService->can($report->view_name, 'report')) { |
|
53 | 53 | Errors::noPermissions(); |
54 | 54 | } |
55 | 55 |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | interface ReportServiceInterface extends BaseServiceInterface |
8 | 8 | { |
9 | - /** |
|
10 | - * Render the given report db view based on the given |
|
11 | - * condition. |
|
12 | - * |
|
13 | - * @param string $reportName |
|
14 | - * @param array $conditions |
|
15 | - * @param integer $perPage |
|
16 | - * @param bool $skipPermission |
|
17 | - * @return mixed |
|
18 | - */ |
|
19 | - public function getReport(string $reportName, array $conditions = [], int $perPage = 0, bool $skipPermission = false): mixed; |
|
9 | + /** |
|
10 | + * Render the given report db view based on the given |
|
11 | + * condition. |
|
12 | + * |
|
13 | + * @param string $reportName |
|
14 | + * @param array $conditions |
|
15 | + * @param integer $perPage |
|
16 | + * @param bool $skipPermission |
|
17 | + * @return mixed |
|
18 | + */ |
|
19 | + public function getReport(string $reportName, array $conditions = [], int $perPage = 0, bool $skipPermission = false): mixed; |
|
20 | 20 | } |