@@ -7,10 +7,10 @@ |
||
7 | 7 | |
8 | 8 | class PermissionsController extends BaseApiController |
9 | 9 | { |
10 | - /** |
|
11 | - * The name of the model that is used by the base api controller |
|
12 | - * to preform actions like (add, edit ... etc). |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $model = 'permissions'; |
|
10 | + /** |
|
11 | + * The name of the model that is used by the base api controller |
|
12 | + * to preform actions like (add, edit ... etc). |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $model = 'permissions'; |
|
16 | 16 | } |
@@ -4,13 +4,13 @@ |
||
4 | 4 | { |
5 | 5 | /** |
6 | 6 | * Construct the repository class name based on |
7 | - * the method name called, search in the |
|
8 | - * given namespaces for the class and |
|
9 | - * return an instance. |
|
10 | - * |
|
11 | - * @param string $name the called method name |
|
12 | - * @param array $arguments the method arguments |
|
13 | - * @return object |
|
14 | - */ |
|
7 | + * the method name called, search in the |
|
8 | + * given namespaces for the class and |
|
9 | + * return an instance. |
|
10 | + * |
|
11 | + * @param string $name the called method name |
|
12 | + * @param array $arguments the method arguments |
|
13 | + * @return object |
|
14 | + */ |
|
15 | 15 | public function __call($name, $arguments); |
16 | 16 | } |
17 | 17 | \ No newline at end of file |
@@ -22,15 +22,15 @@ |
||
22 | 22 | "); |
23 | 23 | |
24 | 24 | DB::table('reports')->insert( |
25 | - [ |
|
26 | - [ |
|
25 | + [ |
|
26 | + [ |
|
27 | 27 | 'report_name' => 'admin_count', |
28 | 28 | 'view_name' => 'admin_count', |
29 | 29 | 'created_at' => \DB::raw('NOW()'), |
30 | 30 | 'updated_at' => \DB::raw('NOW()') |
31 | - ] |
|
32 | - ] |
|
33 | - ); |
|
31 | + ] |
|
32 | + ] |
|
33 | + ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $table->string('view_name',100); |
19 | 19 | $table->softDeletes(); |
20 | 20 | $table->timestamps(); |
21 | - }); |
|
21 | + }); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | use App\User; |
4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
5 | -use Illuminate\Notifications\Notifiable; |
|
6 | 5 | use Laravel\Passport\HasApiTokens; |
7 | 6 | |
8 | 7 | class AclUser extends User { |
@@ -7,119 +7,119 @@ |
||
7 | 7 | |
8 | 8 | class AclUser extends User { |
9 | 9 | |
10 | - use SoftDeletes, HasApiTokens; |
|
11 | - protected $table = 'users'; |
|
12 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
13 | - protected $hidden = ['password', 'remember_token','deleted_at']; |
|
14 | - protected $guarded = ['id']; |
|
15 | - protected $fillable = ['profile_picture', 'name', 'email', 'password']; |
|
16 | - public $searchable = ['name', 'email']; |
|
10 | + use SoftDeletes, HasApiTokens; |
|
11 | + protected $table = 'users'; |
|
12 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
13 | + protected $hidden = ['password', 'remember_token','deleted_at']; |
|
14 | + protected $guarded = ['id']; |
|
15 | + protected $fillable = ['profile_picture', 'name', 'email', 'password']; |
|
16 | + public $searchable = ['name', 'email']; |
|
17 | 17 | |
18 | - public function getCreatedAtAttribute($value) |
|
19 | - { |
|
20 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | - } |
|
22 | - |
|
23 | - public function getUpdatedAtAttribute($value) |
|
24 | - { |
|
25 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
26 | - } |
|
27 | - |
|
28 | - public function getDeletedAtAttribute($value) |
|
29 | - { |
|
30 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * Encrypt the password attribute before |
|
35 | - * saving it in the storage. |
|
36 | - * |
|
37 | - * @param string $value |
|
38 | - */ |
|
39 | - public function setPasswordAttribute($value) |
|
40 | - { |
|
41 | - $this->attributes['password'] = bcrypt($value); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Get the entity's notifications. |
|
46 | - */ |
|
47 | - public function notifications() |
|
48 | - { |
|
49 | - return $this->morphMany('\App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Get the entity's read notifications. |
|
54 | - */ |
|
55 | - public function readNotifications() |
|
56 | - { |
|
57 | - return $this->notifications()->whereNotNull('read_at'); |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Get the entity's unread notifications. |
|
62 | - */ |
|
63 | - public function unreadNotifications() |
|
64 | - { |
|
65 | - return $this->notifications()->whereNull('read_at'); |
|
66 | - } |
|
67 | - |
|
68 | - public function groups() |
|
69 | - { |
|
70 | - return $this->belongsToMany('\App\Modules\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
71 | - } |
|
72 | - |
|
73 | - public function oauthClients() |
|
74 | - { |
|
75 | - return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Return fcm device tokens that will be used in sending fcm notifications. |
|
80 | - * |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function routeNotificationForFCM() |
|
84 | - { |
|
85 | - $devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]); |
|
86 | - $tokens = []; |
|
87 | - |
|
88 | - foreach ($devices as $device) |
|
89 | - { |
|
90 | - $accessToken = decrypt($device->access_token); |
|
91 | - |
|
92 | - try |
|
93 | - { |
|
94 | - if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) |
|
95 | - { |
|
96 | - continue; |
|
97 | - } |
|
98 | - |
|
99 | - $tokens[] = $device->device_token; |
|
100 | - } |
|
101 | - catch (\Exception $e) |
|
102 | - { |
|
103 | - $device->forceDelete(); |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - return $tokens; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * The channels the user receives notification broadcasts on. |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
115 | - public function receivesBroadcastNotificationsOn() |
|
116 | - { |
|
117 | - return 'users.' . $this->id; |
|
118 | - } |
|
18 | + public function getCreatedAtAttribute($value) |
|
19 | + { |
|
20 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
21 | + } |
|
22 | + |
|
23 | + public function getUpdatedAtAttribute($value) |
|
24 | + { |
|
25 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
26 | + } |
|
27 | + |
|
28 | + public function getDeletedAtAttribute($value) |
|
29 | + { |
|
30 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * Encrypt the password attribute before |
|
35 | + * saving it in the storage. |
|
36 | + * |
|
37 | + * @param string $value |
|
38 | + */ |
|
39 | + public function setPasswordAttribute($value) |
|
40 | + { |
|
41 | + $this->attributes['password'] = bcrypt($value); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Get the entity's notifications. |
|
46 | + */ |
|
47 | + public function notifications() |
|
48 | + { |
|
49 | + return $this->morphMany('\App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Get the entity's read notifications. |
|
54 | + */ |
|
55 | + public function readNotifications() |
|
56 | + { |
|
57 | + return $this->notifications()->whereNotNull('read_at'); |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Get the entity's unread notifications. |
|
62 | + */ |
|
63 | + public function unreadNotifications() |
|
64 | + { |
|
65 | + return $this->notifications()->whereNull('read_at'); |
|
66 | + } |
|
67 | + |
|
68 | + public function groups() |
|
69 | + { |
|
70 | + return $this->belongsToMany('\App\Modules\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
71 | + } |
|
72 | + |
|
73 | + public function oauthClients() |
|
74 | + { |
|
75 | + return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Return fcm device tokens that will be used in sending fcm notifications. |
|
80 | + * |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function routeNotificationForFCM() |
|
84 | + { |
|
85 | + $devices = \Core::pushNotificationsDevices()->findBy(['user_id' => $this->id]); |
|
86 | + $tokens = []; |
|
87 | + |
|
88 | + foreach ($devices as $device) |
|
89 | + { |
|
90 | + $accessToken = decrypt($device->access_token); |
|
91 | + |
|
92 | + try |
|
93 | + { |
|
94 | + if (\Core::users()->accessTokenExpiredOrRevoked($accessToken)) |
|
95 | + { |
|
96 | + continue; |
|
97 | + } |
|
98 | + |
|
99 | + $tokens[] = $device->device_token; |
|
100 | + } |
|
101 | + catch (\Exception $e) |
|
102 | + { |
|
103 | + $device->forceDelete(); |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + return $tokens; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * The channels the user receives notification broadcasts on. |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | + public function receivesBroadcastNotificationsOn() |
|
116 | + { |
|
117 | + return 'users.' . $this->id; |
|
118 | + } |
|
119 | 119 | |
120 | - public static function boot() |
|
121 | - { |
|
122 | - parent::boot(); |
|
123 | - parent::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
124 | - } |
|
120 | + public static function boot() |
|
121 | + { |
|
122 | + parent::boot(); |
|
123 | + parent::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
124 | + } |
|
125 | 125 | } |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace App\Modules\Core\Http\Controllers; |
3 | 3 | |
4 | 4 | use App\Http\Controllers\Controller; |
5 | -use Illuminate\Http\Request; |
|
6 | 5 | |
7 | 6 | class ApiDocumentController extends Controller |
8 | 7 | { |
@@ -6,7 +6,6 @@ |
||
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 ResetPassword extends Notification implements ShouldQueue |
12 | 11 | { |
@@ -10,43 +10,43 @@ |
||
10 | 10 | |
11 | 11 | class ResetPassword extends Notification implements ShouldQueue |
12 | 12 | { |
13 | - use Queueable; |
|
13 | + use Queueable; |
|
14 | 14 | |
15 | - protected $token; |
|
15 | + protected $token; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Create a new notification instance. |
|
19 | - * |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function __construct($token) |
|
23 | - { |
|
24 | - $this->token = $token; |
|
25 | - } |
|
17 | + /** |
|
18 | + * Create a new notification instance. |
|
19 | + * |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function __construct($token) |
|
23 | + { |
|
24 | + $this->token = $token; |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Get the notification's delivery channels. |
|
29 | - * |
|
30 | - * @param mixed $notifiable |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - public function via($notifiable) |
|
34 | - { |
|
35 | - return ['mail']; |
|
36 | - } |
|
27 | + /** |
|
28 | + * Get the notification's delivery channels. |
|
29 | + * |
|
30 | + * @param mixed $notifiable |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + public function via($notifiable) |
|
34 | + { |
|
35 | + return ['mail']; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Get the mail representation of the notification. |
|
40 | - * |
|
41 | - * @param mixed $notifiable |
|
42 | - * @return \Illuminate\Notifications\Messages\MailMessage |
|
43 | - */ |
|
44 | - public function toMail($notifiable) |
|
45 | - { |
|
46 | - return (new MailMessage) |
|
47 | - ->subject('Reset passowrd') |
|
48 | - ->line('Reset passowrd') |
|
49 | - ->line('To reset your password click on the button below') |
|
50 | - ->action('Reset password', config('reset_password_url') . '/' . $this->token); |
|
51 | - } |
|
38 | + /** |
|
39 | + * Get the mail representation of the notification. |
|
40 | + * |
|
41 | + * @param mixed $notifiable |
|
42 | + * @return \Illuminate\Notifications\Messages\MailMessage |
|
43 | + */ |
|
44 | + public function toMail($notifiable) |
|
45 | + { |
|
46 | + return (new MailMessage) |
|
47 | + ->subject('Reset passowrd') |
|
48 | + ->line('Reset passowrd') |
|
49 | + ->line('To reset your password click on the button below') |
|
50 | + ->action('Reset password', config('reset_password_url') . '/' . $this->token); |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | \ No newline at end of file |
@@ -5,32 +5,32 @@ |
||
5 | 5 | |
6 | 6 | class Report extends Model{ |
7 | 7 | |
8 | - use SoftDeletes; |
|
8 | + use SoftDeletes; |
|
9 | 9 | protected $table = 'reports'; |
10 | 10 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
11 | 11 | protected $hidden = ['deleted_at']; |
12 | 12 | protected $guarded = ['id']; |
13 | 13 | protected $fillable = ['report_name', 'view_name']; |
14 | - public $searchable = ['report_name', 'view_name']; |
|
14 | + public $searchable = ['report_name', 'view_name']; |
|
15 | 15 | |
16 | 16 | public function getCreatedAtAttribute($value) |
17 | - { |
|
18 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
19 | - } |
|
17 | + { |
|
18 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
19 | + } |
|
20 | 20 | |
21 | - public function getUpdatedAtAttribute($value) |
|
22 | - { |
|
23 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
24 | - } |
|
21 | + public function getUpdatedAtAttribute($value) |
|
22 | + { |
|
23 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
24 | + } |
|
25 | 25 | |
26 | - public function getDeletedAtAttribute($value) |
|
27 | - { |
|
28 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
29 | - } |
|
26 | + public function getDeletedAtAttribute($value) |
|
27 | + { |
|
28 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
29 | + } |
|
30 | 30 | |
31 | - public static function boot() |
|
32 | - { |
|
33 | - parent::boot(); |
|
34 | - parent::observe(\App::make('App\Modules\Reporting\ModelObservers\ReprotObserver')); |
|
35 | - } |
|
31 | + public static function boot() |
|
32 | + { |
|
33 | + parent::boot(); |
|
34 | + parent::observe(\App::make('App\Modules\Reporting\ModelObservers\ReprotObserver')); |
|
35 | + } |
|
36 | 36 | } |
@@ -8,72 +8,72 @@ |
||
8 | 8 | class RouteServiceProvider extends ServiceProvider |
9 | 9 | { |
10 | 10 | /** |
11 | - * This namespace is applied to your controller routes. |
|
12 | - * |
|
13 | - * In addition, it is set as the URL generator's root namespace. |
|
14 | - * |
|
15 | - * @var string |
|
16 | - */ |
|
17 | - protected $namespace = 'App\Modules\Reporting\Http\Controllers'; |
|
11 | + * This namespace is applied to your controller routes. |
|
12 | + * |
|
13 | + * In addition, it is set as the URL generator's root namespace. |
|
14 | + * |
|
15 | + * @var string |
|
16 | + */ |
|
17 | + protected $namespace = 'App\Modules\Reporting\Http\Controllers'; |
|
18 | 18 | |
19 | - /** |
|
20 | - * Define your route model bindings, pattern filters, etc. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function boot() |
|
25 | - { |
|
26 | - // |
|
19 | + /** |
|
20 | + * Define your route model bindings, pattern filters, etc. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function boot() |
|
25 | + { |
|
26 | + // |
|
27 | 27 | |
28 | - parent::boot(); |
|
29 | - } |
|
28 | + parent::boot(); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Define the routes for the module. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function map() |
|
37 | - { |
|
38 | - $this->mapWebRoutes(); |
|
31 | + /** |
|
32 | + * Define the routes for the module. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function map() |
|
37 | + { |
|
38 | + $this->mapWebRoutes(); |
|
39 | 39 | |
40 | - $this->mapApiRoutes(); |
|
40 | + $this->mapApiRoutes(); |
|
41 | 41 | |
42 | - // |
|
43 | - } |
|
42 | + // |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Define the "web" routes for the module. |
|
47 | - * |
|
48 | - * These routes all receive session state, CSRF protection, etc. |
|
49 | - * |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - protected function mapWebRoutes() |
|
53 | - { |
|
54 | - Route::group([ |
|
55 | - 'middleware' => 'web', |
|
56 | - 'namespace' => $this->namespace, |
|
57 | - ], function ($router) { |
|
58 | - require module_path('reporting', 'Routes/web.php'); |
|
59 | - }); |
|
60 | - } |
|
45 | + /** |
|
46 | + * Define the "web" routes for the module. |
|
47 | + * |
|
48 | + * These routes all receive session state, CSRF protection, etc. |
|
49 | + * |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + protected function mapWebRoutes() |
|
53 | + { |
|
54 | + Route::group([ |
|
55 | + 'middleware' => 'web', |
|
56 | + 'namespace' => $this->namespace, |
|
57 | + ], function ($router) { |
|
58 | + require module_path('reporting', 'Routes/web.php'); |
|
59 | + }); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Define the "api" routes for the module. |
|
64 | - * |
|
65 | - * These routes are typically stateless. |
|
66 | - * |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - protected function mapApiRoutes() |
|
70 | - { |
|
71 | - Route::group([ |
|
72 | - 'middleware' => 'api', |
|
73 | - 'namespace' => $this->namespace, |
|
74 | - 'prefix' => 'api', |
|
75 | - ], function ($router) { |
|
76 | - require module_path('reporting', 'Routes/api.php'); |
|
77 | - }); |
|
78 | - } |
|
62 | + /** |
|
63 | + * Define the "api" routes for the module. |
|
64 | + * |
|
65 | + * These routes are typically stateless. |
|
66 | + * |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + protected function mapApiRoutes() |
|
70 | + { |
|
71 | + Route::group([ |
|
72 | + 'middleware' => 'api', |
|
73 | + 'namespace' => $this->namespace, |
|
74 | + 'prefix' => 'api', |
|
75 | + ], function ($router) { |
|
76 | + require module_path('reporting', 'Routes/api.php'); |
|
77 | + }); |
|
78 | + } |
|
79 | 79 | } |