@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | class ClearDataSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $permissions = \DB::table('permissions')->whereIn('model', ['user', 'permission', 'group', 'oauthClient']); |
|
17 | - \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
18 | - $permissions->delete(); |
|
19 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $permissions = \DB::table('permissions')->whereIn('model', ['user', 'permission', 'group', 'oauthClient']); |
|
17 | + \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
18 | + $permissions->delete(); |
|
19 | + } |
|
20 | 20 | } |
@@ -6,34 +6,34 @@ |
||
6 | 6 | |
7 | 7 | class PermissionsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to permissions table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * Permissions model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'permission', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'find', |
|
32 | - 'model' => 'permission', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - ] |
|
37 | - ); |
|
38 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to permissions table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * Permissions model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'permission', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'find', |
|
32 | + 'model' => 'permission', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + ] |
|
37 | + ); |
|
38 | + } |
|
39 | 39 | } |
@@ -6,70 +6,70 @@ |
||
6 | 6 | |
7 | 7 | class GroupsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to groups table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * Groups model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'group', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'find', |
|
32 | - 'model' => 'group', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'insert', |
|
38 | - 'model' => 'group', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'update', |
|
44 | - 'model' => 'group', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'delete', |
|
50 | - 'model' => 'group', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'deleted', |
|
56 | - 'model' => 'group', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'name' => 'restore', |
|
62 | - 'model' => 'group', |
|
63 | - 'created_at' => \DB::raw('NOW()'), |
|
64 | - 'updated_at' => \DB::raw('NOW()') |
|
65 | - ], |
|
66 | - [ |
|
67 | - 'name' => 'assignPermissions', |
|
68 | - 'model' => 'group', |
|
69 | - 'created_at' => \DB::raw('NOW()'), |
|
70 | - 'updated_at' => \DB::raw('NOW()') |
|
71 | - ], |
|
72 | - ] |
|
73 | - ); |
|
74 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to groups table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * Groups model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'group', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'find', |
|
32 | + 'model' => 'group', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'insert', |
|
38 | + 'model' => 'group', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'update', |
|
44 | + 'model' => 'group', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'delete', |
|
50 | + 'model' => 'group', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'deleted', |
|
56 | + 'model' => 'group', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'name' => 'restore', |
|
62 | + 'model' => 'group', |
|
63 | + 'created_at' => \DB::raw('NOW()'), |
|
64 | + 'updated_at' => \DB::raw('NOW()') |
|
65 | + ], |
|
66 | + [ |
|
67 | + 'name' => 'assignPermissions', |
|
68 | + 'model' => 'group', |
|
69 | + 'created_at' => \DB::raw('NOW()'), |
|
70 | + 'updated_at' => \DB::raw('NOW()') |
|
71 | + ], |
|
72 | + ] |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | } |
@@ -6,58 +6,58 @@ |
||
6 | 6 | |
7 | 7 | class OauthClientsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to oauthClients table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * OauthClients model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'oauthClient', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'find', |
|
32 | - 'model' => 'oauthClient', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'insert', |
|
38 | - 'model' => 'oauthClient', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'update', |
|
44 | - 'model' => 'oauthClient', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'revoke', |
|
50 | - 'model' => 'oauthClient', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'unRevoke', |
|
56 | - 'model' => 'oauthClient', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - ] |
|
61 | - ); |
|
62 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to oauthClients table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * OauthClients model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'oauthClient', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'find', |
|
32 | + 'model' => 'oauthClient', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'insert', |
|
38 | + 'model' => 'oauthClient', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'update', |
|
44 | + 'model' => 'oauthClient', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'revoke', |
|
50 | + 'model' => 'oauthClient', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'unRevoke', |
|
56 | + 'model' => 'oauthClient', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + ] |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | } |
@@ -7,133 +7,133 @@ |
||
7 | 7 | class AclUser extends User |
8 | 8 | { |
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', 'locale', 'timezone']; |
|
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', 'locale', 'timezone']; |
|
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 | - * Get the profile picture url. |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function getProfilePictureAttribute($value) |
|
38 | - { |
|
39 | - return url(\Storage::url($value)); |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * Encrypt the password attribute before |
|
44 | - * saving it in the storage. |
|
45 | - * |
|
46 | - * @param string $value |
|
47 | - */ |
|
48 | - public function setPasswordAttribute($value) |
|
49 | - { |
|
50 | - $this->attributes['password'] = bcrypt($value); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Get the entity's notifications. |
|
55 | - */ |
|
56 | - public function notifications() |
|
57 | - { |
|
58 | - return $this->morphMany('App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Get the entity's read notifications. |
|
63 | - */ |
|
64 | - public function readNotifications() |
|
65 | - { |
|
66 | - return $this->notifications()->whereNotNull('read_at'); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Get the entity's unread notifications. |
|
71 | - */ |
|
72 | - public function unreadNotifications() |
|
73 | - { |
|
74 | - return $this->notifications()->whereNull('read_at'); |
|
75 | - } |
|
76 | - |
|
77 | - public function groups() |
|
78 | - { |
|
79 | - return $this->belongsToMany('App\Modules\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
80 | - } |
|
81 | - |
|
82 | - public function oauthClients() |
|
83 | - { |
|
84 | - return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Return fcm device tokens that will be used in sending fcm notifications. |
|
89 | - * |
|
90 | - * @return array |
|
91 | - */ |
|
92 | - public function routeNotificationForFCM() |
|
93 | - { |
|
94 | - $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
95 | - $tokens = []; |
|
96 | - |
|
97 | - foreach ($devices as $device) { |
|
98 | - if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) { |
|
99 | - $device->forceDelete(); |
|
100 | - continue; |
|
101 | - } |
|
102 | - |
|
103 | - $tokens[] = $device->device_token; |
|
104 | - } |
|
105 | - |
|
106 | - return $tokens; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * The channels the user receives notification broadcasts on. |
|
111 | - * |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - public function receivesBroadcastNotificationsOn() |
|
115 | - { |
|
116 | - return 'users.'.$this->id; |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * Custom password validation. |
|
121 | - * |
|
122 | - * @param string $password |
|
123 | - * @return boolean |
|
124 | - */ |
|
125 | - public function validateForPassportPasswordGrant($password) |
|
126 | - { |
|
127 | - if ($password == config('skeleton.social_pass')) { |
|
128 | - return true; |
|
129 | - } |
|
130 | - |
|
131 | - return \Hash::check($password, $this->password); |
|
132 | - } |
|
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 | + * Get the profile picture url. |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function getProfilePictureAttribute($value) |
|
38 | + { |
|
39 | + return url(\Storage::url($value)); |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * Encrypt the password attribute before |
|
44 | + * saving it in the storage. |
|
45 | + * |
|
46 | + * @param string $value |
|
47 | + */ |
|
48 | + public function setPasswordAttribute($value) |
|
49 | + { |
|
50 | + $this->attributes['password'] = bcrypt($value); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Get the entity's notifications. |
|
55 | + */ |
|
56 | + public function notifications() |
|
57 | + { |
|
58 | + return $this->morphMany('App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Get the entity's read notifications. |
|
63 | + */ |
|
64 | + public function readNotifications() |
|
65 | + { |
|
66 | + return $this->notifications()->whereNotNull('read_at'); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Get the entity's unread notifications. |
|
71 | + */ |
|
72 | + public function unreadNotifications() |
|
73 | + { |
|
74 | + return $this->notifications()->whereNull('read_at'); |
|
75 | + } |
|
76 | + |
|
77 | + public function groups() |
|
78 | + { |
|
79 | + return $this->belongsToMany('App\Modules\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
80 | + } |
|
81 | + |
|
82 | + public function oauthClients() |
|
83 | + { |
|
84 | + return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Return fcm device tokens that will be used in sending fcm notifications. |
|
89 | + * |
|
90 | + * @return array |
|
91 | + */ |
|
92 | + public function routeNotificationForFCM() |
|
93 | + { |
|
94 | + $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
95 | + $tokens = []; |
|
96 | + |
|
97 | + foreach ($devices as $device) { |
|
98 | + if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) { |
|
99 | + $device->forceDelete(); |
|
100 | + continue; |
|
101 | + } |
|
102 | + |
|
103 | + $tokens[] = $device->device_token; |
|
104 | + } |
|
105 | + |
|
106 | + return $tokens; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * The channels the user receives notification broadcasts on. |
|
111 | + * |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + public function receivesBroadcastNotificationsOn() |
|
115 | + { |
|
116 | + return 'users.'.$this->id; |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * Custom password validation. |
|
121 | + * |
|
122 | + * @param string $password |
|
123 | + * @return boolean |
|
124 | + */ |
|
125 | + public function validateForPassportPasswordGrant($password) |
|
126 | + { |
|
127 | + if ($password == config('skeleton.social_pass')) { |
|
128 | + return true; |
|
129 | + } |
|
130 | + |
|
131 | + return \Hash::check($password, $this->password); |
|
132 | + } |
|
133 | 133 | |
134 | - public static function boot() |
|
135 | - { |
|
136 | - parent::boot(); |
|
137 | - AclUser::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
138 | - } |
|
134 | + public static function boot() |
|
135 | + { |
|
136 | + parent::boot(); |
|
137 | + AclUser::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
138 | + } |
|
139 | 139 | } |
@@ -6,20 +6,20 @@ |
||
6 | 6 | |
7 | 7 | class Report extends JsonResource |
8 | 8 | { |
9 | - /** |
|
10 | - * Transform the resource into an array. |
|
11 | - * |
|
12 | - * @param Request $request |
|
13 | - * @return array |
|
14 | - */ |
|
15 | - public function toArray($request) |
|
16 | - { |
|
17 | - return [ |
|
18 | - 'id' => $this->id, |
|
19 | - 'report_name' => $this->report_name, |
|
20 | - 'view_name' => $this->view_name, |
|
21 | - 'created_at' => $this->created_at, |
|
22 | - 'updated_at' => $this->updated_at, |
|
23 | - ]; |
|
24 | - } |
|
9 | + /** |
|
10 | + * Transform the resource into an array. |
|
11 | + * |
|
12 | + * @param Request $request |
|
13 | + * @return array |
|
14 | + */ |
|
15 | + public function toArray($request) |
|
16 | + { |
|
17 | + return [ |
|
18 | + 'id' => $this->id, |
|
19 | + 'report_name' => $this->report_name, |
|
20 | + 'view_name' => $this->view_name, |
|
21 | + 'created_at' => $this->created_at, |
|
22 | + 'updated_at' => $this->updated_at, |
|
23 | + ]; |
|
24 | + } |
|
25 | 25 | } |
@@ -13,15 +13,15 @@ |
||
13 | 13 | |
14 | 14 | Route::group(['prefix' => 'reporting'], function () { |
15 | 15 | |
16 | - Route::group(['prefix' => 'reports'], function () { |
|
16 | + Route::group(['prefix' => 'reports'], function () { |
|
17 | 17 | |
18 | - Route::get('/', 'ReportController@index'); |
|
19 | - Route::get('/{id}', 'ReportController@find'); |
|
20 | - Route::post('/', 'ReportController@insert'); |
|
21 | - Route::put('/', 'ReportController@update'); |
|
22 | - Route::delete('/{id}', 'ReportController@delete'); |
|
23 | - Route::get('list/deleted', 'ReportController@deleted'); |
|
24 | - Route::patch('restore/{id}', 'ReportController@restore'); |
|
25 | - Route::post('get/{reportName}', 'ReportController@getReport'); |
|
26 | - }); |
|
18 | + Route::get('/', 'ReportController@index'); |
|
19 | + Route::get('/{id}', 'ReportController@find'); |
|
20 | + Route::post('/', 'ReportController@insert'); |
|
21 | + Route::put('/', 'ReportController@update'); |
|
22 | + Route::delete('/{id}', 'ReportController@delete'); |
|
23 | + Route::get('list/deleted', 'ReportController@deleted'); |
|
24 | + Route::patch('restore/{id}', 'ReportController@restore'); |
|
25 | + Route::post('get/{reportName}', 'ReportController@getReport'); |
|
26 | + }); |
|
27 | 27 | }); |
@@ -11,9 +11,9 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Route::group(['prefix' => 'reporting'], function () { |
|
14 | +Route::group(['prefix' => 'reporting'], function() { |
|
15 | 15 | |
16 | - Route::group(['prefix' => 'reports'], function () { |
|
16 | + Route::group(['prefix' => 'reports'], function() { |
|
17 | 17 | |
18 | 18 | Route::get('/', 'ReportController@index'); |
19 | 19 | Route::get('/{id}', 'ReportController@find'); |
@@ -6,40 +6,40 @@ |
||
6 | 6 | |
7 | 7 | class ReportsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to settings table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * Reports model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'index', |
|
26 | - 'model' => 'report', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'find', |
|
32 | - 'model' => 'report', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'admin_count', |
|
38 | - 'model' => 'report', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ] |
|
42 | - ] |
|
43 | - ); |
|
44 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to settings table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * Reports model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'index', |
|
26 | + 'model' => 'report', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'find', |
|
32 | + 'model' => 'report', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'admin_count', |
|
38 | + 'model' => 'report', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ] |
|
42 | + ] |
|
43 | + ); |
|
44 | + } |
|
45 | 45 | } |
@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class AssignRelationsSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Assign the permissions to the admin group. |
|
20 | - */ |
|
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function ($permission) use ($adminGroupId) { |
|
22 | - \DB::table('groups_permissions')->insert( |
|
23 | - [ |
|
24 | - 'permission_id' => $permission->id, |
|
25 | - 'group_id' => $adminGroupId, |
|
26 | - 'created_at' => \DB::raw('NOW()'), |
|
27 | - 'updated_at' => \DB::raw('NOW()') |
|
28 | - ] |
|
29 | - ); |
|
30 | - }); |
|
31 | - } |
|
18 | + /** |
|
19 | + * Assign the permissions to the admin group. |
|
20 | + */ |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function ($permission) use ($adminGroupId) { |
|
22 | + \DB::table('groups_permissions')->insert( |
|
23 | + [ |
|
24 | + 'permission_id' => $permission->id, |
|
25 | + 'group_id' => $adminGroupId, |
|
26 | + 'created_at' => \DB::raw('NOW()'), |
|
27 | + 'updated_at' => \DB::raw('NOW()') |
|
28 | + ] |
|
29 | + ); |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * Assign the permissions to the admin group. |
20 | 20 | */ |
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function ($permission) use ($adminGroupId) { |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function($permission) use ($adminGroupId) { |
|
22 | 22 | \DB::table('groups_permissions')->insert( |
23 | 23 | [ |
24 | 24 | 'permission_id' => $permission->id, |