Completed
Push — master ( 2d22de...e2d103 )
by Sherif
02:14
created
src/Modules/Notifications/Repositories/PushNotificationDeviceRepository.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -7,59 +7,59 @@
 block discarded – undo
7 7
 
8 8
 class PushNotificationDeviceRepository extends AbstractRepository
9 9
 {
10
-    /**
11
-     * Return the model full namespace.
12
-     *
13
-     * @return string
14
-     */
15
-    protected function getModel()
16
-    {
17
-        return 'App\Modules\Notifications\PushNotificationDevice';
18
-    }
10
+	/**
11
+	 * Return the model full namespace.
12
+	 *
13
+	 * @return string
14
+	 */
15
+	protected function getModel()
16
+	{
17
+		return 'App\Modules\Notifications\PushNotificationDevice';
18
+	}
19 19
 
20
-    /**
21
-     * Register the given device to the logged in user.
22
-     *
23
-     * @param  array $data
24
-     * @return void
25
-     */
26
-    public function registerDevice($data)
27
-    {
28
-        $data['access_token'] = \Auth::user()->token();
29
-        $data['user_id']      = \Auth::id();
30
-        $device               = $this->model->where('device_token', $data['device_token'])->
31
-                                              where('user_id', $data['user_id'])->
32
-                                              first();
20
+	/**
21
+	 * Register the given device to the logged in user.
22
+	 *
23
+	 * @param  array $data
24
+	 * @return void
25
+	 */
26
+	public function registerDevice($data)
27
+	{
28
+		$data['access_token'] = \Auth::user()->token();
29
+		$data['user_id']      = \Auth::id();
30
+		$device               = $this->model->where('device_token', $data['device_token'])->
31
+											  where('user_id', $data['user_id'])->
32
+											  first();
33 33
 
34
-        if ($device) {
35
-            $data['id'] = $device->id;
36
-        }
34
+		if ($device) {
35
+			$data['id'] = $device->id;
36
+		}
37 37
 
38
-        return $this->save($data);
39
-    }
38
+		return $this->save($data);
39
+	}
40 40
 
41
-    /**
42
-     * Generate the given message data.
43
-     *
44
-     * @param  string $title
45
-     * @param  string $message
46
-     * @param  array  $data
47
-     * @return void
48
-     */
49
-    public function generateMessageData($title, $message, $data = [])
50
-    {
51
-        $optionBuilder       = new OptionsBuilder();
52
-        $notificationBuilder = new PayloadNotificationBuilder($title);
53
-        $dataBuilder         = new PayloadDataBuilder();
41
+	/**
42
+	 * Generate the given message data.
43
+	 *
44
+	 * @param  string $title
45
+	 * @param  string $message
46
+	 * @param  array  $data
47
+	 * @return void
48
+	 */
49
+	public function generateMessageData($title, $message, $data = [])
50
+	{
51
+		$optionBuilder       = new OptionsBuilder();
52
+		$notificationBuilder = new PayloadNotificationBuilder($title);
53
+		$dataBuilder         = new PayloadDataBuilder();
54 54
 
55
-        $optionBuilder->setTimeToLive(60 * 20);
56
-        $notificationBuilder->setBody($message);
57
-        $dataBuilder->addData($data);
55
+		$optionBuilder->setTimeToLive(60 * 20);
56
+		$notificationBuilder->setBody($message);
57
+		$dataBuilder->addData($data);
58 58
 
59
-        $options             = $optionBuilder->build();
60
-        $notification        = $notificationBuilder->build();
61
-        $data                = $dataBuilder->build();
59
+		$options             = $optionBuilder->build();
60
+		$notification        = $notificationBuilder->build();
61
+		$data                = $dataBuilder->build();
62 62
 
63
-        return compact('options', 'notification', 'data');
64
-    }
63
+		return compact('options', 'notification', 'data');
64
+	}
65 65
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Database/Factories/ReportFactory.php 2 patches
Indentation   +6 added lines, -6 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 [
5
-        'report_name' => $faker->randomElement(['Users Count', 'Low Stock Products', 'Active Users']),
6
-        'view_name'   => $faker->word(),
7
-        'created_at'  => $faker->dateTimeBetween('-1 years', 'now'),
8
-        'updated_at'  => $faker->dateTimeBetween('-1 years', 'now')
9
-    ];
4
+	return [
5
+		'report_name' => $faker->randomElement(['Users Count', 'Low Stock Products', 'Active Users']),
6
+		'view_name'   => $faker->word(),
7
+		'created_at'  => $faker->dateTimeBetween('-1 years', 'now'),
8
+		'updated_at'  => $faker->dateTimeBetween('-1 years', 'now')
9
+	];
10 10
 });
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.
Modules/Reporting/Database/Migrations/2016_01_19_112603_sampel_report.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 
6 6
 class SampelReport extends Migration
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function up()
14
-    {
15
-        DB::statement("CREATE VIEW admin_count AS  
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		DB::statement("CREATE VIEW admin_count AS  
16 16
 			select count(u.id)
17 17
 			from users u, groups g ,users_groups ug
18 18
 			where
@@ -20,25 +20,25 @@  discard block
 block discarded – undo
20 20
 			ug.group_id = g.id 
21 21
 			");
22 22
         
23
-        DB::table('reports')->insert(
24
-            [
25
-                [
26
-                'report_name' => 'admin_count',
27
-                'view_name'   => 'admin_count',
28
-                'created_at'  => \DB::raw('NOW()'),
29
-                'updated_at'  => \DB::raw('NOW()')
30
-                ]
31
-            ]
32
-        );
33
-    }
23
+		DB::table('reports')->insert(
24
+			[
25
+				[
26
+				'report_name' => 'admin_count',
27
+				'view_name'   => 'admin_count',
28
+				'created_at'  => \DB::raw('NOW()'),
29
+				'updated_at'  => \DB::raw('NOW()')
30
+				]
31
+			]
32
+		);
33
+	}
34 34
 
35
-    /**
36
-     * Reverse the migrations.
37
-     *
38
-     * @return void
39
-     */
40
-    public function down()
41
-    {
42
-        DB::statement("DROP VIEW IF EXISTS admin_count");
43
-    }
35
+	/**
36
+	 * Reverse the migrations.
37
+	 *
38
+	 * @return void
39
+	 */
40
+	public function down()
41
+	{
42
+		DB::statement("DROP VIEW IF EXISTS admin_count");
43
+	}
44 44
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Database/Migrations/2016_01_19_112350_reports.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,29 +5,29 @@
 block discarded – undo
5 5
 
6 6
 class Reports extends Migration
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function up()
14
-    {
15
-        Schema::create('reports', function (Blueprint $table) {
16
-            $table->increments('id');
17
-            $table->string('report_name', 100);
18
-            $table->string('view_name', 100);
19
-            $table->softDeletes();
20
-            $table->timestamps();
21
-        });
22
-    }
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('reports', function (Blueprint $table) {
16
+			$table->increments('id');
17
+			$table->string('report_name', 100);
18
+			$table->string('view_name', 100);
19
+			$table->softDeletes();
20
+			$table->timestamps();
21
+		});
22
+	}
23 23
 
24
-    /**
25
-     * Reverse the migrations.
26
-     *
27
-     * @return void
28
-     */
29
-    public function down()
30
-    {
31
-        Schema::dropIfExists('reports');
32
-    }
24
+	/**
25
+	 * Reverse the migrations.
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function down()
30
+	{
31
+		Schema::dropIfExists('reports');
32
+	}
33 33
 }
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
      */
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 17
             $table->string('report_name', 100);
18 18
             $table->string('view_name', 100);
Please login to merge, or discard this patch.
src/Modules/Reporting/Database/Seeds/AssignRelationsSeeder.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 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(
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', ['reports'])->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
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         /**
19 19
          * Assign the permissions to the admin group.
20 20
          */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function ($permission) use ($adminGroupId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['reports'])->each(function($permission) use ($adminGroupId) {
22 22
             \DB::table('groups_permissions')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
Please login to merge, or discard this patch.
src/Modules/Reporting/Database/Seeds/ReportsTableSeeder.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -6,70 +6,70 @@
 block discarded – undo
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
-                 * Reporting model permissions.
23
-                 */
24
-                [
25
-                'name'       => 'find',
26
-                'model'      => 'reports',
27
-                'created_at' => \DB::raw('NOW()'),
28
-                'updated_at' => \DB::raw('NOW()')
29
-                ],
30
-                [
31
-                'name'       => 'search',
32
-                'model'      => 'reports',
33
-                'created_at' => \DB::raw('NOW()'),
34
-                'updated_at' => \DB::raw('NOW()')
35
-                ],
36
-                [
37
-                'name'       => 'list',
38
-                'model'      => 'reports',
39
-                'created_at' => \DB::raw('NOW()'),
40
-                'updated_at' => \DB::raw('NOW()')
41
-                ],
42
-                [
43
-                'name'       => 'findby',
44
-                'model'      => 'reports',
45
-                'created_at' => \DB::raw('NOW()'),
46
-                'updated_at' => \DB::raw('NOW()')
47
-                ],
48
-                [
49
-                'name'       => 'first',
50
-                'model'      => 'reports',
51
-                'created_at' => \DB::raw('NOW()'),
52
-                'updated_at' => \DB::raw('NOW()')
53
-                ],
54
-                [
55
-                'name'       => 'paginate',
56
-                'model'      => 'reports',
57
-                'created_at' => \DB::raw('NOW()'),
58
-                'updated_at' => \DB::raw('NOW()')
59
-                ],
60
-                [
61
-                'name'       => 'paginateby',
62
-                'model'      => 'reports',
63
-                'created_at' => \DB::raw('NOW()'),
64
-                'updated_at' => \DB::raw('NOW()')
65
-                ],
66
-                [
67
-                'name'       => 'admin_count',
68
-                'model'      => 'reports',
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 settings table.
18
+		 */
19
+		\DB::table('permissions')->insert(
20
+			[
21
+				/**
22
+				 * Reporting model permissions.
23
+				 */
24
+				[
25
+				'name'       => 'find',
26
+				'model'      => 'reports',
27
+				'created_at' => \DB::raw('NOW()'),
28
+				'updated_at' => \DB::raw('NOW()')
29
+				],
30
+				[
31
+				'name'       => 'search',
32
+				'model'      => 'reports',
33
+				'created_at' => \DB::raw('NOW()'),
34
+				'updated_at' => \DB::raw('NOW()')
35
+				],
36
+				[
37
+				'name'       => 'list',
38
+				'model'      => 'reports',
39
+				'created_at' => \DB::raw('NOW()'),
40
+				'updated_at' => \DB::raw('NOW()')
41
+				],
42
+				[
43
+				'name'       => 'findby',
44
+				'model'      => 'reports',
45
+				'created_at' => \DB::raw('NOW()'),
46
+				'updated_at' => \DB::raw('NOW()')
47
+				],
48
+				[
49
+				'name'       => 'first',
50
+				'model'      => 'reports',
51
+				'created_at' => \DB::raw('NOW()'),
52
+				'updated_at' => \DB::raw('NOW()')
53
+				],
54
+				[
55
+				'name'       => 'paginate',
56
+				'model'      => 'reports',
57
+				'created_at' => \DB::raw('NOW()'),
58
+				'updated_at' => \DB::raw('NOW()')
59
+				],
60
+				[
61
+				'name'       => 'paginateby',
62
+				'model'      => 'reports',
63
+				'created_at' => \DB::raw('NOW()'),
64
+				'updated_at' => \DB::raw('NOW()')
65
+				],
66
+				[
67
+				'name'       => 'admin_count',
68
+				'model'      => 'reports',
69
+				'created_at' => \DB::raw('NOW()'),
70
+				'updated_at' => \DB::raw('NOW()')
71
+				]
72
+			]
73
+		);
74
+	}
75 75
 }
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/Seeds/ClearDataSeeder.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 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.
src/Modules/Reporting/Providers/ModuleServiceProvider.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting');
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.