Completed
Push — master ( 2d22de...e2d103 )
by Sherif
02:14
created
src/Modules/Notifications/ModelObservers/NotificationObserver.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -6,53 +6,53 @@
 block discarded – undo
6 6
 class NotificationObserver
7 7
 {
8 8
 
9
-    public function saving($model)
10
-    {
11
-        //
12
-    }
13
-
14
-    public function saved($model)
15
-    {
16
-        //
17
-    }
18
-
19
-    public function creating($model)
20
-    {
21
-        //
22
-    }
23
-
24
-    public function created($model)
25
-    {
26
-        //
27
-    }
28
-
29
-    public function updating($model)
30
-    {
31
-        //
32
-    }
33
-
34
-    public function updated($model)
35
-    {
36
-        //
37
-    }
38
-
39
-    public function deleting($model)
40
-    {
41
-        //
42
-    }
43
-
44
-    public function deleted($model)
45
-    {
46
-        //
47
-    }
48
-
49
-    public function restoring($model)
50
-    {
51
-        //
52
-    }
53
-
54
-    public function restored($model)
55
-    {
56
-        //
57
-    }
9
+	public function saving($model)
10
+	{
11
+		//
12
+	}
13
+
14
+	public function saved($model)
15
+	{
16
+		//
17
+	}
18
+
19
+	public function creating($model)
20
+	{
21
+		//
22
+	}
23
+
24
+	public function created($model)
25
+	{
26
+		//
27
+	}
28
+
29
+	public function updating($model)
30
+	{
31
+		//
32
+	}
33
+
34
+	public function updated($model)
35
+	{
36
+		//
37
+	}
38
+
39
+	public function deleting($model)
40
+	{
41
+		//
42
+	}
43
+
44
+	public function deleted($model)
45
+	{
46
+		//
47
+	}
48
+
49
+	public function restoring($model)
50
+	{
51
+		//
52
+	}
53
+
54
+	public function restored($model)
55
+	{
56
+		//
57
+	}
58 58
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Repositories/NotificationRepository.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -4,72 +4,72 @@
 block discarded – undo
4 4
 
5 5
 class NotificationRepository 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\Notifications\Notification';
15
-    }
7
+	/**
8
+	 * Return the model full namespace.
9
+	 *
10
+	 * @return string
11
+	 */
12
+	protected function getModel()
13
+	{
14
+		return 'App\Modules\Notifications\Notification';
15
+	}
16 16
 
17
-    /**
18
-     * Retrieve all notifications of the logged in user.
19
-     *
20
-     * @param  integer $perPage
21
-     * @return Collection
22
-     */
23
-    public function list($perPage)
24
-    {
25
-        return \Auth::user()->notifications()->paginate($perPage);
26
-    }
17
+	/**
18
+	 * Retrieve all notifications of the logged in user.
19
+	 *
20
+	 * @param  integer $perPage
21
+	 * @return Collection
22
+	 */
23
+	public function list($perPage)
24
+	{
25
+		return \Auth::user()->notifications()->paginate($perPage);
26
+	}
27 27
 
28
-    /**
29
-     * Retrieve unread notifications of the logged in user.
30
-     *
31
-     * @param  integer $perPage
32
-     * @return Collection
33
-     */
34
-    public function unread($perPage)
35
-    {
36
-        return \Auth::user()->unreadNotifications()->paginate($perPage);
37
-    }
28
+	/**
29
+	 * Retrieve unread notifications of the logged in user.
30
+	 *
31
+	 * @param  integer $perPage
32
+	 * @return Collection
33
+	 */
34
+	public function unread($perPage)
35
+	{
36
+		return \Auth::user()->unreadNotifications()->paginate($perPage);
37
+	}
38 38
 
39
-    /**
40
-     * Mark the notification as read.
41
-     *
42
-     * @param  integer  $id
43
-     * @return object
44
-     */
45
-    public function markAsRead($id)
46
-    {
47
-        if ($notification = \Auth::user()->unreadNotifications()->where('id', $id)->first()) {
48
-            $notification->markAsRead();
49
-        }
50
-    }
39
+	/**
40
+	 * Mark the notification as read.
41
+	 *
42
+	 * @param  integer  $id
43
+	 * @return object
44
+	 */
45
+	public function markAsRead($id)
46
+	{
47
+		if ($notification = \Auth::user()->unreadNotifications()->where('id', $id)->first()) {
48
+			$notification->markAsRead();
49
+		}
50
+	}
51 51
 
52
-    /**
53
-     * Mark all notifications as read.
54
-     *
55
-     * @return void
56
-     */
57
-    public function markAllAsRead()
58
-    {
59
-        \Auth::user()->unreadNotifications()->update(['read_at' => now()]);
60
-    }
52
+	/**
53
+	 * Mark all notifications as read.
54
+	 *
55
+	 * @return void
56
+	 */
57
+	public function markAllAsRead()
58
+	{
59
+		\Auth::user()->unreadNotifications()->update(['read_at' => now()]);
60
+	}
61 61
 
62
-    /**
63
-     * Notify th given user with the given notification.
64
-     *
65
-     * @param  collection $users
66
-     * @param  string     $notification
67
-     * @param  object     $notificationData
68
-     * @return void
69
-     */
70
-    public function notify($users, $notification, $notificationData = false)
71
-    {
72
-        $notification = 'App\Modules\Notifications\Notifications\\'.$notification;
73
-        \Notification::send($users, new $notification($notificationData));
74
-    }
62
+	/**
63
+	 * Notify th given user with the given notification.
64
+	 *
65
+	 * @param  collection $users
66
+	 * @param  string     $notification
67
+	 * @param  object     $notificationData
68
+	 * @return void
69
+	 */
70
+	public function notify($users, $notification, $notificationData = false)
71
+	{
72
+		$notification = 'App\Modules\Notifications\Notifications\\'.$notification;
73
+		\Notification::send($users, new $notification($notificationData));
74
+	}
75 75
 }
Please login to merge, or discard this patch.
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 1 patch
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.
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 1 patch
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.
src/Modules/Reporting/Database/Seeds/AssignRelationsSeeder.php 1 patch
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.
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.