Completed
Push — master ( f304b0...0b265b )
by Sherif
02:43
created
src/Modules/Reporting/Database/Seeds/AssignRelationsSeeder.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@  discard block
 block discarded – undo
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', ['reports'])->each(function ($permission) use ($adminGroupId) {
22
-        	\DB::table('groups_permissions')->insert(
18
+		/**
19
+		 * Assign the permissions to the admin group.
20
+		 */
21
+		\DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function ($permission) use ($adminGroupId) {
22
+			\DB::table('groups_permissions')->insert(
23 23
 				[
24 24
 				'permission_id' => $permission->id,
25 25
 				'group_id'      => $adminGroupId,
@@ -27,6 +27,6 @@  discard block
 block discarded – undo
27 27
 				'updated_at'    => \DB::raw('NOW()')
28 28
 				]
29 29
 			);
30
-        });
31
-    }
30
+		});
31
+	}
32 32
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
         /**
22 22
          * Assign the permissions to the admin group.
23 23
          */
24
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function ($permission) use ($adminGroupId) {
24
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function($permission) use ($adminGroupId) {
25 25
         	\DB::table('groups_permissions')->insert(
26 26
 				[
27 27
 				'permission_id' => $permission->id,
Please login to merge, or discard this patch.
src/Modules/Reporting/Database/Seeds/ClearDataSeeder.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
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', ['reports']);
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', ['reports']);
17
+		\DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
+		$permissions->delete();
19
+	}
20 20
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function run()
15 15
     {
16
-        $permissions  = \DB::table('permissions')->whereIn('model', ['reports']);
16
+        $permissions = \DB::table('permissions')->whereIn('model', ['reports']);
17 17
         \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18 18
         $permissions->delete();
19 19
     }
Please login to merge, or discard this patch.
src/Modules/Reporting/Database/Seeds/ReportingDatabaseSeeder.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 
7 7
 class ReportingDatabaseSeeder extends Seeder
8 8
 {
9
-    /**
10
-     * Run the database seeds.
11
-     *
12
-     * @return void
13
-     */
14
-    public function run()
15
-    {
16
-        $this->call(ClearDataSeeder::class);
17
-    	$this->call(ReportsTableSeeder::class);
18
-        $this->call(AssignRelationsSeeder::class);
19
-    }
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		$this->call(ClearDataSeeder::class);
17
+		$this->call(ReportsTableSeeder::class);
18
+		$this->call(AssignRelationsSeeder::class);
19
+	}
20 20
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Database/Factories/ReportFactory.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $factory->define(App\Modules\Reporting\Report::class, function (Faker\Generator $faker) {
4
-    return [
4
+	return [
5 5
 		'report_name' => $faker->randomElement(['Users Count', 'Low Stock Products', 'Active Users']),
6 6
 		'view_name'   => $faker->word(),
7 7
 		'created_at'  => $faker->dateTimeBetween('-1 years', 'now'),
8 8
 		'updated_at'  => $faker->dateTimeBetween('-1 years', 'now')
9
-    ];
9
+	];
10 10
 });
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$factory->define(App\Modules\Reporting\Report::class, function (Faker\Generator $faker) {
3
+$factory->define(App\Modules\Reporting\Report::class, function(Faker\Generator $faker) {
4 4
     return [
5 5
 		'report_name' => $faker->randomElement(['Users Count', 'Low Stock Products', 'Active Users']),
6 6
 		'view_name'   => $faker->word(),
Please login to merge, or discard this patch.
src/Modules/Reporting/Http/Controllers/ReportsController.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@
 block discarded – undo
7 7
 
8 8
 class ReportsController 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               = 'reports';
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';
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 = ['getReport'];
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 = ['getReport'];
23 23
 
24
-    /**
25
-     * Render the given report name with the given conditions.
26
-     *
27
-     * @param  \Illuminate\Http\Request  $request
28
-     * @param  string  $reportName Name of the requested report
29
-     * @param  integer $perPage    Number of rows per page default all data.
30
-     * @return \Illuminate\Http\Response
31
-     */
32
-    public function getReport(Request $request, $reportName, $perPage = 0) 
33
-    {
34
-        return \Response::json($this->repo->getReport($reportName, $request->all(), $perPage), 200);
35
-    }
24
+	/**
25
+	 * Render the given report name with the given conditions.
26
+	 *
27
+	 * @param  \Illuminate\Http\Request  $request
28
+	 * @param  string  $reportName Name of the requested report
29
+	 * @param  integer $perPage    Number of rows per page default all data.
30
+	 * @return \Illuminate\Http\Response
31
+	 */
32
+	public function getReport(Request $request, $reportName, $perPage = 0) 
33
+	{
34
+		return \Response::json($this->repo->getReport($reportName, $request->all(), $perPage), 200);
35
+	}
36 36
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Modules/Reporting/ModelObservers/ReprotObserver.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -5,53 +5,53 @@
 block discarded – undo
5 5
  */
6 6
 class ReprotObserver {
7 7
 
8
-    public function saving($model)
9
-    {
10
-        //
11
-    }
12
-
13
-    public function saved($model)
14
-    {
15
-        //
16
-    }
17
-
18
-    public function creating($model)
19
-    {
20
-        //
21
-    }
22
-
23
-    public function created($model)
24
-    {
25
-        //
26
-    }
27
-
28
-    public function updating($model)
29
-    {
30
-        //
31
-    }
32
-
33
-    public function updated($model)
34
-    {
35
-        //
36
-    }
37
-
38
-    public function deleting($model)
39
-    {
40
-        //
41
-    }
42
-
43
-    public function deleted($model)
44
-    {
45
-        //
46
-    }
47
-
48
-    public function restoring($model)
49
-    {
50
-        //
51
-    }
52
-
53
-    public function restored($model)
54
-    {
55
-        //
56
-    }
8
+	public function saving($model)
9
+	{
10
+		//
11
+	}
12
+
13
+	public function saved($model)
14
+	{
15
+		//
16
+	}
17
+
18
+	public function creating($model)
19
+	{
20
+		//
21
+	}
22
+
23
+	public function created($model)
24
+	{
25
+		//
26
+	}
27
+
28
+	public function updating($model)
29
+	{
30
+		//
31
+	}
32
+
33
+	public function updated($model)
34
+	{
35
+		//
36
+	}
37
+
38
+	public function deleting($model)
39
+	{
40
+		//
41
+	}
42
+
43
+	public function deleted($model)
44
+	{
45
+		//
46
+	}
47
+
48
+	public function restoring($model)
49
+	{
50
+		//
51
+	}
52
+
53
+	public function restored($model)
54
+	{
55
+		//
56
+	}
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/Reporting/Repositories/ReportRepository.php 3 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -4,67 +4,67 @@
 block discarded – undo
4 4
 
5 5
 class ReportRepository extends AbstractRepository
6 6
 {
7
-    /**
8
-     * Return the model full namespace.
9
-     * 
10
-     * @return string
11
-     */
12
-    protected function getModel()
13
-    {
14
-        return 'App\Modules\Reporting\Report';
15
-    }
7
+	/**
8
+	 * Return the model full namespace.
9
+	 * 
10
+	 * @return string
11
+	 */
12
+	protected function getModel()
13
+	{
14
+		return 'App\Modules\Reporting\Report';
15
+	}
16 16
 
17
-    /**
18
-     * Render the given report db view based on the given
19
-     * condition.
20
-     *
21
-     * @param  string  $reportName
22
-     * @param  array   $conditions array of conditions
23
-     * @param  integer $perPage
24
-     * @param  array   $relations
25
-     * @param  boolean   $skipPermission
26
-     * @return object
27
-     */
28
-    public function getReport($reportName, $conditions = false, $perPage = 0, $relations = [], $skipPermission = false)
29
-    {
30
-        /**
31
-         * Fetch the report from db.
32
-         */
33
-        $reportConditions = $this->constructConditions(['report_name' => $reportName], $this->model);
34
-        $report           = call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($reportConditions['conditionString'], $reportConditions['conditionValues'])->first();
17
+	/**
18
+	 * Render the given report db view based on the given
19
+	 * condition.
20
+	 *
21
+	 * @param  string  $reportName
22
+	 * @param  array   $conditions array of conditions
23
+	 * @param  integer $perPage
24
+	 * @param  array   $relations
25
+	 * @param  boolean   $skipPermission
26
+	 * @return object
27
+	 */
28
+	public function getReport($reportName, $conditions = false, $perPage = 0, $relations = [], $skipPermission = false)
29
+	{
30
+		/**
31
+		 * Fetch the report from db.
32
+		 */
33
+		$reportConditions = $this->constructConditions(['report_name' => $reportName], $this->model);
34
+		$report           = call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($reportConditions['conditionString'], $reportConditions['conditionValues'])->first();
35 35
         
36
-        /**
37
-         * Check report existance and permission.
38
-         */
39
-        if ( ! $report) 
40
-        {
41
-            \ErrorHandler::notFound('report');
42
-        }
43
-        else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
44
-        {
45
-            \ErrorHandler::noPermissions();
46
-        }
36
+		/**
37
+		 * Check report existance and permission.
38
+		 */
39
+		if ( ! $report) 
40
+		{
41
+			\ErrorHandler::notFound('report');
42
+		}
43
+		else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
44
+		{
45
+			\ErrorHandler::noPermissions();
46
+		}
47 47
 
48
-        /**
49
-         * Fetch data from the report based on the given conditions.
50
-         */
51
-        $report = \DB::table($report->view_name);
52
-        unset($conditions['page']);
53
-        if (count($conditions))
54
-        {
55
-            $conditions = $this->constructConditions($conditions, $this->model);
56
-            $report->whereRaw($conditions['conditionString'], $conditions['conditionValues']);   
57
-        }
58
-        /**
59
-         * Paginate or all data.
60
-         */
61
-        if ($perPage) 
62
-        {
63
-            return $report->paginate($perPage);
64
-        }
65
-        else
66
-        {
67
-            return $report->get();  
68
-        }
69
-    }
48
+		/**
49
+		 * Fetch data from the report based on the given conditions.
50
+		 */
51
+		$report = \DB::table($report->view_name);
52
+		unset($conditions['page']);
53
+		if (count($conditions))
54
+		{
55
+			$conditions = $this->constructConditions($conditions, $this->model);
56
+			$report->whereRaw($conditions['conditionString'], $conditions['conditionValues']);   
57
+		}
58
+		/**
59
+		 * Paginate or all data.
60
+		 */
61
+		if ($perPage) 
62
+		{
63
+			return $report->paginate($perPage);
64
+		}
65
+		else
66
+		{
67
+			return $report->get();  
68
+		}
69
+	}
70 70
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
         {
41 41
             \ErrorHandler::notFound('report');
42 42
         }
43
-        else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
43
+        else if ( ! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
44 44
         {
45 45
             \ErrorHandler::noPermissions();
46 46
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@  discard block
 block discarded – undo
39 39
         if ( ! $report) 
40 40
         {
41 41
             \ErrorHandler::notFound('report');
42
-        }
43
-        else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
42
+        } else if (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports'))
44 43
         {
45 44
             \ErrorHandler::noPermissions();
46 45
         }
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
         if ($perPage) 
62 61
         {
63 62
             return $report->paginate($perPage);
64
-        }
65
-        else
63
+        } else
66 64
         {
67 65
             return $report->get();  
68 66
         }
Please login to merge, or discard this patch.
src/Modules/Notifications/Providers/RouteServiceProvider.php 2 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -8,72 +8,72 @@
 block discarded – undo
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\Notifications\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\Notifications\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('notifications', '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('notifications', '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('notifications', '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('notifications', 'Routes/api.php');
77
+		});
78
+	}
79 79
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         Route::group([
55 55
             'middleware' => 'web',
56 56
             'namespace'  => $this->namespace,
57
-        ], function ($router) {
57
+        ], function($router) {
58 58
             require module_path('notifications', 'Routes/web.php');
59 59
         });
60 60
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             'middleware' => 'api',
73 73
             'namespace'  => $this->namespace,
74 74
             'prefix'     => 'api',
75
-        ], function ($router) {
75
+        ], function($router) {
76 76
             require module_path('notifications', 'Routes/api.php');
77 77
         });
78 78
     }
Please login to merge, or discard this patch.
src/Modules/Notifications/Providers/ModuleServiceProvider.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@
 block discarded – undo
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9 9
 	/**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'notification');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'notification');
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'notification');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'notification');
18 18
         
19
-        $factory = app('Illuminate\Database\Eloquent\Factory');
20
-        $factory->load(__DIR__.'/../Database/Factories');
21
-    }
19
+		$factory = app('Illuminate\Database\Eloquent\Factory');
20
+		$factory->load(__DIR__.'/../Database/Factories');
21
+	}
22 22
 
23
-    /**
24
-     * Register the module services.
25
-     *
26
-     * @return void
27
-     */
28
-    public function register()
29
-    {
30
-        $this->app->register(RouteServiceProvider::class);
31
-    }
23
+	/**
24
+	 * Register the module services.
25
+	 *
26
+	 * @return void
27
+	 */
28
+	public function register()
29
+	{
30
+		$this->app->register(RouteServiceProvider::class);
31
+	}
32 32
 }
Please login to merge, or discard this patch.