@@ -6,16 +6,16 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CoreDatabaseSeeder 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(LogsTableSeeder::class); |
|
| 18 | - $this->call(SettingsTableSeeder::class); |
|
| 19 | - $this->call(AssignRelationsSeeder::class); |
|
| 20 | - } |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $this->call(ClearDataSeeder::class); |
|
| 17 | + $this->call(LogsTableSeeder::class); |
|
| 18 | + $this->call(SettingsTableSeeder::class); |
|
| 19 | + $this->call(AssignRelationsSeeder::class); |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -6,21 +6,21 @@ |
||
| 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', ['users', 'permissions', 'groups']); |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $permissions = \DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups']); |
|
| 17 | 17 | |
| 18 | - \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 19 | - \DB::table('users_groups')->delete(); |
|
| 18 | + \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 19 | + \DB::table('users_groups')->delete(); |
|
| 20 | 20 | |
| 21 | - \DB::table('users')->delete(); |
|
| 22 | - \DB::table('groups')->delete(); |
|
| 21 | + \DB::table('users')->delete(); |
|
| 22 | + \DB::table('groups')->delete(); |
|
| 23 | 23 | |
| 24 | - $permissions->delete(); |
|
| 25 | - } |
|
| 24 | + $permissions->delete(); |
|
| 25 | + } |
|
| 26 | 26 | } |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\V1\Acl\AclUser::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 4 | + return [ |
|
| 5 | 5 | 'name' => $faker->name(), |
| 6 | 6 | 'email' => $faker->safeEmail(), |
| 7 | 7 | 'password' => bcrypt(str_random(10)), |
| 8 | 8 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
| 9 | 9 | 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
| 10 | - ]; |
|
| 10 | + ]; |
|
| 11 | 11 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\V1\Acl\AclUser::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\V1\Acl\AclUser::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->name(), |
| 6 | 6 | 'email' => $faker->safeEmail(), |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\V1\Acl\AclGroup::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 4 | + return [ |
|
| 5 | 5 | 'name' => $faker->unique->word(), |
| 6 | 6 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
| 7 | 7 | 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
| 8 | - ]; |
|
| 8 | + ]; |
|
| 9 | 9 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\V1\Acl\AclGroup::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\V1\Acl\AclGroup::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->unique->word(), |
| 6 | 6 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\V1\Acl\AclPermission::class, function (Faker\Generator $faker) { |
| 4 | - return [ |
|
| 4 | + return [ |
|
| 5 | 5 | 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
| 6 | 6 | 'model' => $faker->randomElement(['users', 'groups', 'settings', 'notifications']), |
| 7 | 7 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
| 8 | 8 | 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
| 9 | - ]; |
|
| 9 | + ]; |
|
| 10 | 10 | }); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\V1\Acl\AclPermission::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\V1\Acl\AclPermission::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->randomElement(['save', 'delete', 'find', 'paginate']), |
| 6 | 6 | 'model' => $faker->randomElement(['users', 'groups', 'settings', 'notifications']), |
@@ -5,53 +5,53 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclPermissionObserver { |
| 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 |
@@ -5,66 +5,66 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclUserObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - // |
|
| 21 | - } |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + // |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - public function updating($model) |
|
| 29 | - { |
|
| 30 | - if ($model->password) |
|
| 31 | - { |
|
| 32 | - $model->last_change_password = \Carbon\Carbon::now()->toDateTimeString(); |
|
| 33 | - } |
|
| 34 | - } |
|
| 28 | + public function updating($model) |
|
| 29 | + { |
|
| 30 | + if ($model->password) |
|
| 31 | + { |
|
| 32 | + $model->last_change_password = \Carbon\Carbon::now()->toDateTimeString(); |
|
| 33 | + } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - public function updated($model) |
|
| 37 | - { |
|
| 38 | - // |
|
| 39 | - } |
|
| 36 | + public function updated($model) |
|
| 37 | + { |
|
| 38 | + // |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Soft delete user logs. |
|
| 43 | - * |
|
| 44 | - * @param object $model the delted model. |
|
| 45 | - * @return void |
|
| 46 | - */ |
|
| 47 | - public function deleting($model) |
|
| 48 | - { |
|
| 49 | - if ($model->getOriginal('id') == \JWTAuth::parseToken()->authenticate()->id) |
|
| 50 | - { |
|
| 51 | - \ErrorHandler::noPermissions(); |
|
| 52 | - } |
|
| 53 | - $model->logs()->delete(); |
|
| 54 | - } |
|
| 41 | + /** |
|
| 42 | + * Soft delete user logs. |
|
| 43 | + * |
|
| 44 | + * @param object $model the delted model. |
|
| 45 | + * @return void |
|
| 46 | + */ |
|
| 47 | + public function deleting($model) |
|
| 48 | + { |
|
| 49 | + if ($model->getOriginal('id') == \JWTAuth::parseToken()->authenticate()->id) |
|
| 50 | + { |
|
| 51 | + \ErrorHandler::noPermissions(); |
|
| 52 | + } |
|
| 53 | + $model->logs()->delete(); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - public function deleted($model) |
|
| 57 | - { |
|
| 58 | - // |
|
| 59 | - } |
|
| 56 | + public function deleted($model) |
|
| 57 | + { |
|
| 58 | + // |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function restoring($model) |
|
| 62 | - { |
|
| 63 | - $model->logs()->restore(); |
|
| 64 | - } |
|
| 61 | + public function restoring($model) |
|
| 62 | + { |
|
| 63 | + $model->logs()->restore(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function restored($model) |
|
| 67 | - { |
|
| 68 | - // |
|
| 69 | - } |
|
| 66 | + public function restored($model) |
|
| 67 | + { |
|
| 68 | + // |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |
@@ -5,71 +5,71 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclGroupObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - // |
|
| 21 | - } |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + // |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Prevent updating of the admin group. |
|
| 30 | - * |
|
| 31 | - * @param object $model the model beign updated. |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function updating($model) |
|
| 35 | - { |
|
| 36 | - if ($model->getOriginal('name') == 'Admin') |
|
| 37 | - { |
|
| 38 | - \ErrorHandler::noPermissions(); |
|
| 39 | - } |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * Prevent updating of the admin group. |
|
| 30 | + * |
|
| 31 | + * @param object $model the model beign updated. |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function updating($model) |
|
| 35 | + { |
|
| 36 | + if ($model->getOriginal('name') == 'Admin') |
|
| 37 | + { |
|
| 38 | + \ErrorHandler::noPermissions(); |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function updated($model) |
|
| 43 | - { |
|
| 44 | - // |
|
| 45 | - } |
|
| 42 | + public function updated($model) |
|
| 43 | + { |
|
| 44 | + // |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Prevent deleting the admin group. |
|
| 49 | - * |
|
| 50 | - * @param object $model the delted model. |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - public function deleting($model) |
|
| 54 | - { |
|
| 55 | - if ($model->getOriginal('name') == 'Admin') |
|
| 56 | - { |
|
| 57 | - \ErrorHandler::noPermissions(); |
|
| 58 | - } |
|
| 59 | - } |
|
| 47 | + /** |
|
| 48 | + * Prevent deleting the admin group. |
|
| 49 | + * |
|
| 50 | + * @param object $model the delted model. |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + public function deleting($model) |
|
| 54 | + { |
|
| 55 | + if ($model->getOriginal('name') == 'Admin') |
|
| 56 | + { |
|
| 57 | + \ErrorHandler::noPermissions(); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function deleted($model) |
|
| 62 | - { |
|
| 63 | - // |
|
| 64 | - } |
|
| 61 | + public function deleted($model) |
|
| 62 | + { |
|
| 63 | + // |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function restoring($model) |
|
| 67 | - { |
|
| 68 | - // |
|
| 69 | - } |
|
| 66 | + public function restoring($model) |
|
| 67 | + { |
|
| 68 | + // |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - public function restored($model) |
|
| 72 | - { |
|
| 73 | - // |
|
| 74 | - } |
|
| 71 | + public function restored($model) |
|
| 72 | + { |
|
| 73 | + // |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | \ No newline at end of file |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $factory->define(App\Modules\V1\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 |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\V1\Reporting\Report::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\V1\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(), |