@@ -3,7 +3,7 @@ |
||
3 | 3 | use Illuminate\Database\Eloquent\Model; |
4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
5 | 5 | |
6 | -class Notification extends Model{ |
|
6 | +class Notification extends Model { |
|
7 | 7 | |
8 | 8 | use SoftDeletes; |
9 | 9 | protected $table = 'notifications'; |
@@ -5,36 +5,36 @@ |
||
5 | 5 | |
6 | 6 | class Notification extends Model{ |
7 | 7 | |
8 | - use SoftDeletes; |
|
9 | - protected $table = 'notifications'; |
|
10 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
11 | - protected $hidden = ['deleted_at', 'item_type']; |
|
12 | - protected $guarded = ['id']; |
|
13 | - protected $fillable = ['name', 'description', 'item_name', 'item_type', 'item_id', 'notified']; |
|
8 | + use SoftDeletes; |
|
9 | + protected $table = 'notifications'; |
|
10 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
11 | + protected $hidden = ['deleted_at', 'item_type']; |
|
12 | + protected $guarded = ['id']; |
|
13 | + protected $fillable = ['name', 'description', 'item_name', 'item_type', 'item_id', 'notified']; |
|
14 | 14 | |
15 | - public function getCreatedAtAttribute($value) |
|
16 | - { |
|
17 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
18 | - } |
|
15 | + public function getCreatedAtAttribute($value) |
|
16 | + { |
|
17 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
18 | + } |
|
19 | 19 | |
20 | - public function getUpdatedAtAttribute($value) |
|
21 | - { |
|
22 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
23 | - } |
|
20 | + public function getUpdatedAtAttribute($value) |
|
21 | + { |
|
22 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
23 | + } |
|
24 | 24 | |
25 | - public function getDeletedAtAttribute($value) |
|
26 | - { |
|
27 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
28 | - } |
|
25 | + public function getDeletedAtAttribute($value) |
|
26 | + { |
|
27 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
28 | + } |
|
29 | 29 | |
30 | - public function item() |
|
31 | - { |
|
32 | - return $this->morphTo(); |
|
33 | - } |
|
30 | + public function item() |
|
31 | + { |
|
32 | + return $this->morphTo(); |
|
33 | + } |
|
34 | 34 | |
35 | - public static function boot() |
|
36 | - { |
|
37 | - parent::boot(); |
|
38 | - parent::observe(\App::make('App\Modules\Notifications\ModelObservers\NotificationObserver')); |
|
39 | - } |
|
35 | + public static function boot() |
|
36 | + { |
|
37 | + parent::boot(); |
|
38 | + parent::observe(\App::make('App\Modules\Notifications\ModelObservers\NotificationObserver')); |
|
39 | + } |
|
40 | 40 | } |
@@ -12,71 +12,71 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - /** |
|
16 | - * Delete previous permissions. |
|
17 | - */ |
|
15 | + /** |
|
16 | + * Delete previous permissions. |
|
17 | + */ |
|
18 | 18 | DB::table('permissions')->whereIn('model', ['reports'])->delete(); |
19 | 19 | |
20 | 20 | /** |
21 | - * Insert the permissions related to this module. |
|
22 | - */ |
|
23 | - DB::table('permissions')->insert( |
|
24 | - [ |
|
25 | - /** |
|
26 | - * Reporting model permissions. |
|
27 | - */ |
|
28 | - [ |
|
29 | - 'name' => 'find', |
|
30 | - 'model' => 'reports', |
|
31 | - 'created_at' => \DB::raw('NOW()'), |
|
32 | - 'updated_at' => \DB::raw('NOW()') |
|
33 | - ], |
|
34 | - [ |
|
35 | - 'name' => 'search', |
|
36 | - 'model' => 'reports', |
|
37 | - 'created_at' => \DB::raw('NOW()'), |
|
38 | - 'updated_at' => \DB::raw('NOW()') |
|
39 | - ], |
|
40 | - [ |
|
41 | - 'name' => 'list', |
|
42 | - 'model' => 'reports', |
|
43 | - 'created_at' => \DB::raw('NOW()'), |
|
44 | - 'updated_at' => \DB::raw('NOW()') |
|
45 | - ], |
|
46 | - [ |
|
47 | - 'name' => 'findby', |
|
48 | - 'model' => 'reports', |
|
49 | - 'created_at' => \DB::raw('NOW()'), |
|
50 | - 'updated_at' => \DB::raw('NOW()') |
|
51 | - ], |
|
52 | - [ |
|
53 | - 'name' => 'first', |
|
54 | - 'model' => 'reports', |
|
55 | - 'created_at' => \DB::raw('NOW()'), |
|
56 | - 'updated_at' => \DB::raw('NOW()') |
|
57 | - ], |
|
58 | - [ |
|
59 | - 'name' => 'paginate', |
|
60 | - 'model' => 'reports', |
|
61 | - 'created_at' => \DB::raw('NOW()'), |
|
62 | - 'updated_at' => \DB::raw('NOW()') |
|
63 | - ], |
|
64 | - [ |
|
65 | - 'name' => 'paginateby', |
|
66 | - 'model' => 'reports', |
|
67 | - 'created_at' => \DB::raw('NOW()'), |
|
68 | - 'updated_at' => \DB::raw('NOW()') |
|
69 | - ], |
|
70 | - [ |
|
71 | - 'name' => 'admin_count', |
|
72 | - 'model' => 'reports', |
|
73 | - 'created_at' => \DB::raw('NOW()'), |
|
74 | - 'updated_at' => \DB::raw('NOW()') |
|
75 | - ] |
|
76 | - ] |
|
77 | - ); |
|
21 | + * Insert the permissions related to this module. |
|
22 | + */ |
|
23 | + DB::table('permissions')->insert( |
|
24 | + [ |
|
25 | + /** |
|
26 | + * Reporting model permissions. |
|
27 | + */ |
|
28 | + [ |
|
29 | + 'name' => 'find', |
|
30 | + 'model' => 'reports', |
|
31 | + 'created_at' => \DB::raw('NOW()'), |
|
32 | + 'updated_at' => \DB::raw('NOW()') |
|
33 | + ], |
|
34 | + [ |
|
35 | + 'name' => 'search', |
|
36 | + 'model' => 'reports', |
|
37 | + 'created_at' => \DB::raw('NOW()'), |
|
38 | + 'updated_at' => \DB::raw('NOW()') |
|
39 | + ], |
|
40 | + [ |
|
41 | + 'name' => 'list', |
|
42 | + 'model' => 'reports', |
|
43 | + 'created_at' => \DB::raw('NOW()'), |
|
44 | + 'updated_at' => \DB::raw('NOW()') |
|
45 | + ], |
|
46 | + [ |
|
47 | + 'name' => 'findby', |
|
48 | + 'model' => 'reports', |
|
49 | + 'created_at' => \DB::raw('NOW()'), |
|
50 | + 'updated_at' => \DB::raw('NOW()') |
|
51 | + ], |
|
52 | + [ |
|
53 | + 'name' => 'first', |
|
54 | + 'model' => 'reports', |
|
55 | + 'created_at' => \DB::raw('NOW()'), |
|
56 | + 'updated_at' => \DB::raw('NOW()') |
|
57 | + ], |
|
58 | + [ |
|
59 | + 'name' => 'paginate', |
|
60 | + 'model' => 'reports', |
|
61 | + 'created_at' => \DB::raw('NOW()'), |
|
62 | + 'updated_at' => \DB::raw('NOW()') |
|
63 | + ], |
|
64 | + [ |
|
65 | + 'name' => 'paginateby', |
|
66 | + 'model' => 'reports', |
|
67 | + 'created_at' => \DB::raw('NOW()'), |
|
68 | + 'updated_at' => \DB::raw('NOW()') |
|
69 | + ], |
|
70 | + [ |
|
71 | + 'name' => 'admin_count', |
|
72 | + 'model' => 'reports', |
|
73 | + 'created_at' => \DB::raw('NOW()'), |
|
74 | + 'updated_at' => \DB::raw('NOW()') |
|
75 | + ] |
|
76 | + ] |
|
77 | + ); |
|
78 | 78 | |
79 | - /** |
|
79 | + /** |
|
80 | 80 | * Assign the permissions to the admin group. |
81 | 81 | */ |
82 | 82 | $permissionIds = DB::table('permissions')->whereIn('model', ['reports'])->select('id')->lists('id'); |
@@ -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 | /** |
@@ -12,8 +12,8 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - DB::statement( "DROP VIEW IF EXISTS admin_count"); |
|
16 | - DB::statement( "CREATE VIEW admin_count AS |
|
15 | + DB::statement("DROP VIEW IF EXISTS admin_count"); |
|
16 | + DB::statement("CREATE VIEW admin_count AS |
|
17 | 17 | select count(u.id) |
18 | 18 | from users u, groups g ,users_groups ug |
19 | 19 | where |
@@ -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 | /** |
@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('reports', function (Blueprint $table) { |
|
15 | + Schema::create('reports', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | - $table->string('report_name',100); |
|
18 | - $table->string('view_name',100); |
|
17 | + $table->string('report_name', 100); |
|
18 | + $table->string('view_name', 100); |
|
19 | 19 | $table->softDeletes(); |
20 | 20 | $table->timestamps(); |
21 | 21 | }); |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Illuminate\Database\Eloquent\Model; |
4 | 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
5 | 5 | |
6 | -class Report extends Model{ |
|
6 | +class Report extends Model { |
|
7 | 7 | |
8 | 8 | use SoftDeletes; |
9 | 9 | protected $table = 'reports'; |
@@ -5,7 +5,7 @@ discard block |
||
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']; |
@@ -13,23 +13,23 @@ discard block |
||
13 | 13 | protected $fillable = ['report_name', 'view_name']; |
14 | 14 | |
15 | 15 | public function getCreatedAtAttribute($value) |
16 | - { |
|
17 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
18 | - } |
|
16 | + { |
|
17 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
18 | + } |
|
19 | 19 | |
20 | - public function getUpdatedAtAttribute($value) |
|
21 | - { |
|
22 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
23 | - } |
|
20 | + public function getUpdatedAtAttribute($value) |
|
21 | + { |
|
22 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
23 | + } |
|
24 | 24 | |
25 | - public function getDeletedAtAttribute($value) |
|
26 | - { |
|
27 | - return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
28 | - } |
|
25 | + public function getDeletedAtAttribute($value) |
|
26 | + { |
|
27 | + return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString(); |
|
28 | + } |
|
29 | 29 | |
30 | - public static function boot() |
|
31 | - { |
|
32 | - parent::boot(); |
|
33 | - parent::observe(\App::make('App\Modules\Reporting\ModelObservers\ReprotObserver')); |
|
34 | - } |
|
30 | + public static function boot() |
|
31 | + { |
|
32 | + parent::boot(); |
|
33 | + parent::observe(\App::make('App\Modules\Reporting\ModelObservers\ReprotObserver')); |
|
34 | + } |
|
35 | 35 | } |
@@ -12,77 +12,77 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - /** |
|
16 | - * Delete previous permissions. |
|
17 | - */ |
|
15 | + /** |
|
16 | + * Delete previous permissions. |
|
17 | + */ |
|
18 | 18 | DB::table('permissions')->whereIn('model', ['notifications'])->delete(); |
19 | 19 | |
20 | 20 | /** |
21 | - * Insert the permissions related to this module. |
|
22 | - */ |
|
23 | - DB::table('permissions')->insert( |
|
24 | - [ |
|
25 | - /** |
|
26 | - * Logs model permissions. |
|
27 | - */ |
|
28 | - [ |
|
29 | - 'name' => 'find', |
|
30 | - 'model' => 'notifications', |
|
31 | - 'created_at' => \DB::raw('NOW()'), |
|
32 | - 'updated_at' => \DB::raw('NOW()') |
|
33 | - ], |
|
34 | - [ |
|
35 | - 'name' => 'search', |
|
36 | - 'model' => 'notifications', |
|
37 | - 'created_at' => \DB::raw('NOW()'), |
|
38 | - 'updated_at' => \DB::raw('NOW()') |
|
39 | - ], |
|
40 | - [ |
|
41 | - 'name' => 'list', |
|
42 | - 'model' => 'notifications', |
|
43 | - 'created_at' => \DB::raw('NOW()'), |
|
44 | - 'updated_at' => \DB::raw('NOW()') |
|
45 | - ], |
|
46 | - [ |
|
47 | - 'name' => 'findby', |
|
48 | - 'model' => 'notifications', |
|
49 | - 'created_at' => \DB::raw('NOW()'), |
|
50 | - 'updated_at' => \DB::raw('NOW()') |
|
51 | - ], |
|
52 | - [ |
|
53 | - 'name' => 'first', |
|
54 | - 'model' => 'notifications', |
|
55 | - 'created_at' => \DB::raw('NOW()'), |
|
56 | - 'updated_at' => \DB::raw('NOW()') |
|
57 | - ], |
|
58 | - [ |
|
59 | - 'name' => 'paginate', |
|
60 | - 'model' => 'notifications', |
|
61 | - 'created_at' => \DB::raw('NOW()'), |
|
62 | - 'updated_at' => \DB::raw('NOW()') |
|
63 | - ], |
|
64 | - [ |
|
65 | - 'name' => 'paginateby', |
|
66 | - 'model' => 'notifications', |
|
67 | - 'created_at' => \DB::raw('NOW()'), |
|
68 | - 'updated_at' => \DB::raw('NOW()') |
|
69 | - ], |
|
70 | - [ |
|
71 | - 'name' => 'notified', |
|
72 | - 'model' => 'notifications', |
|
73 | - 'created_at' => \DB::raw('NOW()'), |
|
74 | - 'updated_at' => \DB::raw('NOW()') |
|
75 | - ], |
|
76 | - [ |
|
77 | - 'name' => 'notifyall', |
|
78 | - 'model' => 'notifications', |
|
79 | - 'created_at' => \DB::raw('NOW()'), |
|
80 | - 'updated_at' => \DB::raw('NOW()') |
|
81 | - ], |
|
82 | - ] |
|
83 | - ); |
|
21 | + * Insert the permissions related to this module. |
|
22 | + */ |
|
23 | + DB::table('permissions')->insert( |
|
24 | + [ |
|
25 | + /** |
|
26 | + * Logs model permissions. |
|
27 | + */ |
|
28 | + [ |
|
29 | + 'name' => 'find', |
|
30 | + 'model' => 'notifications', |
|
31 | + 'created_at' => \DB::raw('NOW()'), |
|
32 | + 'updated_at' => \DB::raw('NOW()') |
|
33 | + ], |
|
34 | + [ |
|
35 | + 'name' => 'search', |
|
36 | + 'model' => 'notifications', |
|
37 | + 'created_at' => \DB::raw('NOW()'), |
|
38 | + 'updated_at' => \DB::raw('NOW()') |
|
39 | + ], |
|
40 | + [ |
|
41 | + 'name' => 'list', |
|
42 | + 'model' => 'notifications', |
|
43 | + 'created_at' => \DB::raw('NOW()'), |
|
44 | + 'updated_at' => \DB::raw('NOW()') |
|
45 | + ], |
|
46 | + [ |
|
47 | + 'name' => 'findby', |
|
48 | + 'model' => 'notifications', |
|
49 | + 'created_at' => \DB::raw('NOW()'), |
|
50 | + 'updated_at' => \DB::raw('NOW()') |
|
51 | + ], |
|
52 | + [ |
|
53 | + 'name' => 'first', |
|
54 | + 'model' => 'notifications', |
|
55 | + 'created_at' => \DB::raw('NOW()'), |
|
56 | + 'updated_at' => \DB::raw('NOW()') |
|
57 | + ], |
|
58 | + [ |
|
59 | + 'name' => 'paginate', |
|
60 | + 'model' => 'notifications', |
|
61 | + 'created_at' => \DB::raw('NOW()'), |
|
62 | + 'updated_at' => \DB::raw('NOW()') |
|
63 | + ], |
|
64 | + [ |
|
65 | + 'name' => 'paginateby', |
|
66 | + 'model' => 'notifications', |
|
67 | + 'created_at' => \DB::raw('NOW()'), |
|
68 | + 'updated_at' => \DB::raw('NOW()') |
|
69 | + ], |
|
70 | + [ |
|
71 | + 'name' => 'notified', |
|
72 | + 'model' => 'notifications', |
|
73 | + 'created_at' => \DB::raw('NOW()'), |
|
74 | + 'updated_at' => \DB::raw('NOW()') |
|
75 | + ], |
|
76 | + [ |
|
77 | + 'name' => 'notifyall', |
|
78 | + 'model' => 'notifications', |
|
79 | + 'created_at' => \DB::raw('NOW()'), |
|
80 | + 'updated_at' => \DB::raw('NOW()') |
|
81 | + ], |
|
82 | + ] |
|
83 | + ); |
|
84 | 84 | |
85 | - /** |
|
85 | + /** |
|
86 | 86 | * Assign the permissions to the admin group. |
87 | 87 | */ |
88 | 88 | $permissionIds = DB::table('permissions')->whereIn('model', ['notifications'])->select('id')->lists('id'); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | * |
47 | 47 | * @param array $conditions array of conditions |
48 | 48 | * @param array $relations |
49 | - * @param array $colunmns |
|
49 | + * @param array $columns |
|
50 | 50 | * @return object |
51 | 51 | */ |
52 | 52 | public function first($conditions, $relations = [], $columns = array('*')) |
@@ -11,63 +11,63 @@ |
||
11 | 11 | */ |
12 | 12 | protected function getModel() |
13 | 13 | { |
14 | - $apiVersion = \Request::header('api-version') ?: 1; |
|
14 | + $apiVersion = \Request::header('api-version') ?: 1; |
|
15 | 15 | return 'App\Modules\Reporting\Report'; |
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
19 | - * Render the given report db view. |
|
20 | - * |
|
21 | - * @param integer $id |
|
22 | - * @param array $relations |
|
23 | - * @param array $columns |
|
24 | - * @return object |
|
25 | - */ |
|
26 | - public function find($id, $relations = [], $columns = array('*')) |
|
27 | - { |
|
19 | + * Render the given report db view. |
|
20 | + * |
|
21 | + * @param integer $id |
|
22 | + * @param array $relations |
|
23 | + * @param array $columns |
|
24 | + * @return object |
|
25 | + */ |
|
26 | + public function find($id, $relations = [], $columns = array('*')) |
|
27 | + { |
|
28 | 28 | $report = call_user_func_array("{$this->getModel()}::with", array($relations))->find($id, $columns); |
29 | 29 | |
30 | - if ( ! $report) |
|
31 | - { |
|
32 | - $error = \ErrorHandler::notFound('report'); |
|
33 | - abort($error['status'], $error['message']); |
|
34 | - } |
|
30 | + if ( ! $report) |
|
31 | + { |
|
32 | + $error = \ErrorHandler::notFound('report'); |
|
33 | + abort($error['status'], $error['message']); |
|
34 | + } |
|
35 | 35 | |
36 | - if ( ! \Core::users()->can($report->view_name, 'reports')) |
|
37 | - { |
|
38 | - $error = \ErrorHandler::noPermissions(); |
|
39 | - abort($error['status'], $error['message']); |
|
40 | - } |
|
36 | + if ( ! \Core::users()->can($report->view_name, 'reports')) |
|
37 | + { |
|
38 | + $error = \ErrorHandler::noPermissions(); |
|
39 | + abort($error['status'], $error['message']); |
|
40 | + } |
|
41 | 41 | |
42 | - return \DB::table($report->view_name)->get(); |
|
43 | - } |
|
42 | + return \DB::table($report->view_name)->get(); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Render the given report db view based on the given |
|
47 | - * condition. |
|
48 | - * |
|
49 | - * @param array $conditions array of conditions |
|
50 | - * @param array $relations |
|
51 | - * @param array $colunmns |
|
52 | - * @return object |
|
53 | - */ |
|
54 | - public function first($conditions, $relations = [], $columns = array('*')) |
|
55 | - { |
|
45 | + /** |
|
46 | + * Render the given report db view based on the given |
|
47 | + * condition. |
|
48 | + * |
|
49 | + * @param array $conditions array of conditions |
|
50 | + * @param array $relations |
|
51 | + * @param array $colunmns |
|
52 | + * @return object |
|
53 | + */ |
|
54 | + public function first($conditions, $relations = [], $columns = array('*')) |
|
55 | + { |
|
56 | 56 | $conditions = $this->constructConditions($conditions); |
57 | 57 | $report = call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->first($columns); |
58 | 58 | |
59 | - if ( ! $report) |
|
60 | - { |
|
61 | - $error = \ErrorHandler::notFound('report'); |
|
62 | - abort($error['status'], $error['message']); |
|
63 | - } |
|
59 | + if ( ! $report) |
|
60 | + { |
|
61 | + $error = \ErrorHandler::notFound('report'); |
|
62 | + abort($error['status'], $error['message']); |
|
63 | + } |
|
64 | 64 | |
65 | - if ( ! \Core::users()->can($report->view_name, 'reports')) |
|
66 | - { |
|
67 | - $error = \ErrorHandler::noPermissions(); |
|
68 | - abort($error['status'], $error['message']); |
|
69 | - } |
|
65 | + if ( ! \Core::users()->can($report->view_name, 'reports')) |
|
66 | + { |
|
67 | + $error = \ErrorHandler::noPermissions(); |
|
68 | + abort($error['status'], $error['message']); |
|
69 | + } |
|
70 | 70 | |
71 | - return \DB::table($report->view_name)->get(); |
|
72 | - } |
|
71 | + return \DB::table($report->view_name)->get(); |
|
72 | + } |
|
73 | 73 | } |
@@ -11,28 +11,28 @@ |
||
11 | 11 | */ |
12 | 12 | protected function getModel() |
13 | 13 | { |
14 | - $apiVersion = \Request::header('api-version') ?: 1; |
|
14 | + $apiVersion = \Request::header('api-version') ?: 1; |
|
15 | 15 | return 'App\Modules\Notifications\Notification'; |
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
19 | - * Set the notification notified to true. |
|
20 | - * |
|
21 | - * @param integer $id |
|
22 | - * @return object |
|
23 | - */ |
|
24 | - public function notified($id) |
|
25 | - { |
|
26 | - return $this->save(['id' => $id, 'notified' => 1]); |
|
27 | - } |
|
19 | + * Set the notification notified to true. |
|
20 | + * |
|
21 | + * @param integer $id |
|
22 | + * @return object |
|
23 | + */ |
|
24 | + public function notified($id) |
|
25 | + { |
|
26 | + return $this->save(['id' => $id, 'notified' => 1]); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Set the notification notified to all. |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function notifyAll() |
|
35 | - { |
|
36 | - \Core::notifications()->update(false, ['notified' => 1], 'notified'); |
|
37 | - } |
|
29 | + /** |
|
30 | + * Set the notification notified to all. |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function notifyAll() |
|
35 | + { |
|
36 | + \Core::notifications()->update(false, ['notified' => 1], 'notified'); |
|
37 | + } |
|
38 | 38 | } |
@@ -8,16 +8,16 @@ |
||
8 | 8 | class ReportsController extends BaseApiController |
9 | 9 | { |
10 | 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 = 'reports'; |
|
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 = 'reports'; |
|
16 | 16 | |
17 | - /** |
|
18 | - * List of all route actions that the base api controller |
|
19 | - * will skip permissions check for them. |
|
20 | - * @var array |
|
21 | - */ |
|
22 | - protected $skipPermissionCheck = ['find', 'first']; |
|
17 | + /** |
|
18 | + * List of all route actions that the base api controller |
|
19 | + * will skip permissions check for them. |
|
20 | + * @var array |
|
21 | + */ |
|
22 | + protected $skipPermissionCheck = ['find', 'first']; |
|
23 | 23 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * to preform actions like (add, edit ... etc). |
13 | 13 | * @var string |
14 | 14 | */ |
15 | - protected $model = 'reports'; |
|
15 | + protected $model = 'reports'; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * List of all route actions that the base api controller |