Completed
Push — master ( bf4aa0...11bc64 )
by Sherif
02:47
created
src/Modules/V1/Notifications/ModelObservers/NotificationObserver.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -5,51 +5,51 @@
 block discarded – undo
5 5
  */
6 6
 class NotificationObserver {
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
-    /**
24
-     * Publish the created notification to the redis server 
25
-     * to broadcast it to all listners.
26
-     * 
27
-     * @param  object $model the model beign created.
28
-     * @return void
29
-     */
30
-    public function created($model)
31
-    {
32
-        \Redis::publish('notification', json_encode($model->toArray()));
33
-    }
34
-
35
-    public function updating($model)
36
-    {
37
-        //
38
-    }
39
-
40
-    public function updated($model)
41
-    {
42
-        //
43
-    }
44
-
45
-    public function deleting($model)
46
-    {
47
-        //
48
-    }
49
-
50
-    public function deleted($model)
51
-    {
52
-        //
53
-    }
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
+	/**
24
+	 * Publish the created notification to the redis server 
25
+	 * to broadcast it to all listners.
26
+	 * 
27
+	 * @param  object $model the model beign created.
28
+	 * @return void
29
+	 */
30
+	public function created($model)
31
+	{
32
+		\Redis::publish('notification', json_encode($model->toArray()));
33
+	}
34
+
35
+	public function updating($model)
36
+	{
37
+		//
38
+	}
39
+
40
+	public function updated($model)
41
+	{
42
+		//
43
+	}
44
+
45
+	public function deleting($model)
46
+	{
47
+		//
48
+	}
49
+
50
+	public function deleted($model)
51
+	{
52
+		//
53
+	}
54 54
 
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Notifications/Http/Controllers/NotificationsController.php 2 patches
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            = 'notifications';
15
+    protected $model = 'notifications';
16 16
 
17 17
     /**
18 18
      * Set the notification notified to true.
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -8,30 +8,30 @@
 block discarded – undo
8 8
 class NotificationsController 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            = 'notifications';
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            = 'notifications';
16 16
 
17
-    /**
18
-     * Set the notification notified to true.
19
-     * 
20
-     * @param  integer  $id
21
-     * @return \Illuminate\Http\Response
22
-     */
23
-    public function notified($id)
24
-    {
25
-        return \Response::json(\Core::notifications()->notified($id), 200);
26
-    }
17
+	/**
18
+	 * Set the notification notified to true.
19
+	 * 
20
+	 * @param  integer  $id
21
+	 * @return \Illuminate\Http\Response
22
+	 */
23
+	public function notified($id)
24
+	{
25
+		return \Response::json(\Core::notifications()->notified($id), 200);
26
+	}
27 27
 
28
-    /**
29
-     * Set the notification notified to all.
30
-     * 
31
-     * @return \Illuminate\Http\Response
32
-     */
33
-    public function notifyall()
34
-    {
35
-        return \Response::json(\Core::notifications()->notifyAll(), 200);
36
-    }
28
+	/**
29
+	 * Set the notification notified to all.
30
+	 * 
31
+	 * @return \Illuminate\Http\Response
32
+	 */
33
+	public function notifyall()
34
+	{
35
+		return \Response::json(\Core::notifications()->notifyAll(), 200);
36
+	}
37 37
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/AclGroup.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Illuminate\Database\Eloquent\Model;
4 4
 use Illuminate\Database\Eloquent\SoftDeletes;
5 5
 
6
-class AclGroup extends Model{
6
+class AclGroup extends Model {
7 7
 
8 8
     use SoftDeletes;
9 9
     protected $table    = 'groups';
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function users()
31 31
     {
32
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclUser','users_groups','group_id','user_id')->whereNull('users_groups.deleted_at')->withTimestamps();
32
+        return $this->belongsToMany('\App\Modules\V1\Acl\AclUser', 'users_groups', 'group_id', 'user_id')->whereNull('users_groups.deleted_at')->withTimestamps();
33 33
     }
34 34
 
35 35
     public function permissions()
36 36
     {
37
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclPermission','groups_permissions','group_id','permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
37
+        return $this->belongsToMany('\App\Modules\V1\Acl\AclPermission', 'groups_permissions', 'group_id', 'permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
38 38
     }
39 39
 
40 40
     public static function boot()
Please login to merge, or discard this patch.
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
 
6 6
 class AclGroup extends Model{
7 7
 
8
-    use SoftDeletes;
9
-    protected $table    = 'groups';
10
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
-    protected $hidden   = ['deleted_at'];
12
-    protected $guarded  = ['id'];
13
-    protected $fillable = ['name'];
14
-    public $searchable  = ['name'];
15
-
16
-    public function getCreatedAtAttribute($value)
17
-    {
18
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
19
-    }
20
-
21
-    public function getUpdatedAtAttribute($value)
22
-    {
23
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
24
-    }
25
-
26
-    public function getDeletedAtAttribute($value)
27
-    {
28
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
29
-    }
30
-
31
-    public function users()
32
-    {
33
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclUser','users_groups','group_id','user_id')->whereNull('users_groups.deleted_at')->withTimestamps();
34
-    }
35
-
36
-    public function permissions()
37
-    {
38
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclPermission','groups_permissions','group_id','permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
39
-    }
40
-
41
-    public static function boot()
42
-    {
43
-        parent::boot();
44
-        parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclGroupObserver'));
45
-    }
8
+	use SoftDeletes;
9
+	protected $table    = 'groups';
10
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
+	protected $hidden   = ['deleted_at'];
12
+	protected $guarded  = ['id'];
13
+	protected $fillable = ['name'];
14
+	public $searchable  = ['name'];
15
+
16
+	public function getCreatedAtAttribute($value)
17
+	{
18
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
19
+	}
20
+
21
+	public function getUpdatedAtAttribute($value)
22
+	{
23
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
24
+	}
25
+
26
+	public function getDeletedAtAttribute($value)
27
+	{
28
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
29
+	}
30
+
31
+	public function users()
32
+	{
33
+		return $this->belongsToMany('\App\Modules\V1\Acl\AclUser','users_groups','group_id','user_id')->whereNull('users_groups.deleted_at')->withTimestamps();
34
+	}
35
+
36
+	public function permissions()
37
+	{
38
+		return $this->belongsToMany('\App\Modules\V1\Acl\AclPermission','groups_permissions','group_id','permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
39
+	}
40
+
41
+	public static function boot()
42
+	{
43
+		parent::boot();
44
+		parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclGroupObserver'));
45
+	}
46 46
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Database/Migrations/2015_12_22_145819_groups.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@
 block discarded – undo
13 13
 	public function up()
14 14
 	{
15 15
 		Schema::create('groups', function (Blueprint $table) {
16
-            $table->increments('id');
17
-            $table->string('name',100)->unique();
18
-            $table->softDeletes();
19
-            $table->timestamps();
20
-        });
16
+			$table->increments('id');
17
+			$table->string('name',100)->unique();
18
+			$table->softDeletes();
19
+			$table->timestamps();
20
+		});
21 21
         
22
-        Schema::create('users_groups', function (Blueprint $table) {
23
-            $table->increments('id');
24
-            $table->integer('user_id');
25
-            $table->integer('group_id');
26
-            $table->softDeletes();
27
-            $table->timestamps();
28
-        });
22
+		Schema::create('users_groups', function (Blueprint $table) {
23
+			$table->increments('id');
24
+			$table->integer('user_id');
25
+			$table->integer('group_id');
26
+			$table->softDeletes();
27
+			$table->timestamps();
28
+		});
29 29
 	}
30 30
 
31 31
 	/**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-		Schema::create('groups', function (Blueprint $table) {
15
+		Schema::create('groups', function(Blueprint $table) {
16 16
             $table->increments('id');
17
-            $table->string('name',100)->unique();
17
+            $table->string('name', 100)->unique();
18 18
             $table->softDeletes();
19 19
             $table->timestamps();
20 20
         });
21 21
         
22
-        Schema::create('users_groups', function (Blueprint $table) {
22
+        Schema::create('users_groups', function(Blueprint $table) {
23 23
             $table->increments('id');
24 24
             $table->integer('user_id');
25 25
             $table->integer('group_id');
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Database/Migrations/2016_01_05_130506_permissions.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,21 +12,21 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-        Schema::create('permissions', function (Blueprint $table) {
16
-            $table->increments('id');
17
-            $table->string('name',100);
18
-            $table->string('model',100);
19
-            $table->softDeletes();
20
-            $table->timestamps();
21
-            $table->unique(array('name', 'model'));
22
-        });
23
-        Schema::create('groups_permissions', function (Blueprint $table) {
24
-            $table->increments('id');
25
-            $table->integer('group_id');
26
-            $table->integer('permission_id');
27
-            $table->softDeletes();
28
-            $table->timestamps();
29
-        });
15
+		Schema::create('permissions', function (Blueprint $table) {
16
+			$table->increments('id');
17
+			$table->string('name',100);
18
+			$table->string('model',100);
19
+			$table->softDeletes();
20
+			$table->timestamps();
21
+			$table->unique(array('name', 'model'));
22
+		});
23
+		Schema::create('groups_permissions', function (Blueprint $table) {
24
+			$table->increments('id');
25
+			$table->integer('group_id');
26
+			$table->integer('permission_id');
27
+			$table->softDeletes();
28
+			$table->timestamps();
29
+		});
30 30
 	}
31 31
 
32 32
 	/**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-        Schema::create('permissions', function (Blueprint $table) {
15
+        Schema::create('permissions', function(Blueprint $table) {
16 16
             $table->increments('id');
17
-            $table->string('name',100);
18
-            $table->string('model',100);
17
+            $table->string('name', 100);
18
+            $table->string('model', 100);
19 19
             $table->softDeletes();
20 20
             $table->timestamps();
21 21
             $table->unique(array('name', 'model'));
22 22
         });
23
-        Schema::create('groups_permissions', function (Blueprint $table) {
23
+        Schema::create('groups_permissions', function(Blueprint $table) {
24 24
             $table->increments('id');
25 25
             $table->integer('group_id');
26 26
             $table->integer('permission_id');
Please login to merge, or discard this patch.
src/Modules/V1/Acl/AclPermission.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     
30 30
     public function groups()
31 31
     {
32
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','groups_permissions','permission_id','group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
32
+        return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
33 33
     }
34 34
 
35 35
     public static function boot()
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,37 +5,37 @@
 block discarded – undo
5 5
 
6 6
 class AclPermission extends Model {
7 7
 
8
-    use SoftDeletes;
9
-    protected $table    = 'permissions';
10
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
-    protected $hidden   = ['deleted_at'];
12
-    protected $guarded  = ['id'];
13
-    protected $fillable = ['name', 'model'];
14
-    public $searchable  = ['name', 'model'];
8
+	use SoftDeletes;
9
+	protected $table    = 'permissions';
10
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
+	protected $hidden   = ['deleted_at'];
12
+	protected $guarded  = ['id'];
13
+	protected $fillable = ['name', 'model'];
14
+	public $searchable  = ['name', 'model'];
15 15
 
16
-    public function getCreatedAtAttribute($value)
17
-    {
18
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
19
-    }
16
+	public function getCreatedAtAttribute($value)
17
+	{
18
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
19
+	}
20 20
 
21
-    public function getUpdatedAtAttribute($value)
22
-    {
23
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
24
-    }
21
+	public function getUpdatedAtAttribute($value)
22
+	{
23
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
24
+	}
25 25
 
26
-    public function getDeletedAtAttribute($value)
27
-    {
28
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
29
-    }
26
+	public function getDeletedAtAttribute($value)
27
+	{
28
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
29
+	}
30 30
     
31
-    public function groups()
32
-    {
33
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','groups_permissions','permission_id','group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
34
-    }
31
+	public function groups()
32
+	{
33
+		return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','groups_permissions','permission_id','group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
34
+	}
35 35
 
36
-    public static function boot()
37
-    {
38
-        parent::boot();
39
-        parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclPermissionObserver'));
40
-    }
36
+	public static function boot()
37
+	{
38
+		parent::boot();
39
+		parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclPermissionObserver'));
40
+	}
41 41
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/PermissionsController.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 
8 8
 class PermissionsController 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 = 'permissions';
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 = 'permissions';
16 16
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/GroupsController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
      * to preform actions like (add, edit ... etc).
14 14
      * @var string
15 15
      */
16
-    protected $model               = 'groups';
16
+    protected $model = 'groups';
17 17
 
18 18
     /**
19 19
      * The validations rules used by the base api controller
20 20
      * to check before add.
21 21
      * @var array
22 22
      */
23
-    protected $validationRules  = [
23
+    protected $validationRules = [
24 24
     'name' => 'required|string|max:100|unique:groups,name,{id}'
25 25
     ];
26 26
 
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,35 +8,35 @@
 block discarded – undo
8 8
 
9 9
 class GroupsController extends BaseApiController
10 10
 {
11
-    /**
12
-     * The name of the model that is used by the base api controller 
13
-     * to preform actions like (add, edit ... etc).
14
-     * @var string
15
-     */
16
-    protected $model               = 'groups';
11
+	/**
12
+	 * The name of the model that is used by the base api controller 
13
+	 * to preform actions like (add, edit ... etc).
14
+	 * @var string
15
+	 */
16
+	protected $model               = 'groups';
17 17
 
18
-    /**
19
-     * The validations rules used by the base api controller
20
-     * to check before add.
21
-     * @var array
22
-     */
23
-    protected $validationRules  = [
24
-    'name' => 'required|string|max:100|unique:groups,name,{id}'
25
-    ];
18
+	/**
19
+	 * The validations rules used by the base api controller
20
+	 * to check before add.
21
+	 * @var array
22
+	 */
23
+	protected $validationRules  = [
24
+	'name' => 'required|string|max:100|unique:groups,name,{id}'
25
+	];
26 26
 
27
-    /**
28
-     * Handle an assign permissions to group request.
29
-     *
30
-     * @param  \Illuminate\Http\Request  $request
31
-     * @return \Illuminate\Http\Response
32
-     */
33
-    public function assignpermissions(Request $request)
34
-    {
35
-        $this->validate($request, [
36
-            'permission_ids' => 'required|exists:permissions,id', 
37
-            'group_id'       => 'required|array|exists:groups,id'
38
-            ]);
27
+	/**
28
+	 * Handle an assign permissions to group request.
29
+	 *
30
+	 * @param  \Illuminate\Http\Request  $request
31
+	 * @return \Illuminate\Http\Response
32
+	 */
33
+	public function assignpermissions(Request $request)
34
+	{
35
+		$this->validate($request, [
36
+			'permission_ids' => 'required|exists:permissions,id', 
37
+			'group_id'       => 'required|array|exists:groups,id'
38
+			]);
39 39
 
40
-        return \Response::json(\Core::groups()->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200);
41
-    }
40
+		return \Response::json(\Core::groups()->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200);
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Modules/V1/Acl/Database/Migrations/2015_12_20_124154_password_resets.php 2 patches
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('password_resets', function (Blueprint $table) {
15
+        Schema::create('password_resets', function(Blueprint $table) {
16 16
             $table->string('email')->index();
17 17
             $table->string('token')->index();
18 18
             $table->timestamp('created_at');
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -5,27 +5,27 @@
 block discarded – undo
5 5
 
6 6
 class PasswordResets extends Migration
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function up()
14
-    {
15
-        Schema::create('password_resets', function (Blueprint $table) {
16
-            $table->string('email')->index();
17
-            $table->string('token')->index();
18
-            $table->timestamp('created_at');
19
-        });
20
-    }
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('password_resets', function (Blueprint $table) {
16
+			$table->string('email')->index();
17
+			$table->string('token')->index();
18
+			$table->timestamp('created_at');
19
+		});
20
+	}
21 21
 
22
-    /**
23
-     * Reverse the migrations.
24
-     *
25
-     * @return void
26
-     */
27
-    public function down()
28
-    {
29
-        Schema::dropIfExists('password_resets');
30
-    }
22
+	/**
23
+	 * Reverse the migrations.
24
+	 *
25
+	 * @return void
26
+	 */
27
+	public function down()
28
+	{
29
+		Schema::dropIfExists('password_resets');
30
+	}
31 31
 }
Please login to merge, or discard this patch.