@@ -6,27 +6,27 @@ |
||
| 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 | - $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Assign the permissions to the admin role. |
|
| 20 | - */ |
|
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['DummyModelName'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | - \DB::table('permission_role')->insert( |
|
| 23 | - [ |
|
| 24 | - 'permission_id' => $permission->id, |
|
| 25 | - 'role_id' => $adminRoleId, |
|
| 26 | - 'created_at' => \DB::raw('NOW()'), |
|
| 27 | - 'updated_at' => \DB::raw('NOW()') |
|
| 28 | - ] |
|
| 29 | - ); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 18 | + /** |
|
| 19 | + * Assign the permissions to the admin role. |
|
| 20 | + */ |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['DummyModelName'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | + \DB::table('permission_role')->insert( |
|
| 23 | + [ |
|
| 24 | + 'permission_id' => $permission->id, |
|
| 25 | + 'role_id' => $adminRoleId, |
|
| 26 | + 'created_at' => \DB::raw('NOW()'), |
|
| 27 | + 'updated_at' => \DB::raw('NOW()') |
|
| 28 | + ] |
|
| 29 | + ); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Assign the permissions to the admin role. |
| 20 | 20 | */ |
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['DummyModelName'])->each(function ($permission) use ($adminRoleId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['DummyModelName'])->each(function($permission) use ($adminRoleId) { |
|
| 22 | 22 | \DB::table('permission_role')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -6,15 +6,15 @@ |
||
| 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', ['DummyModelName']); |
|
| 17 | - \DB::table('permission_role')->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', ['DummyModelName']); |
|
| 17 | + \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | + $permissions->delete(); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -6,27 +6,27 @@ |
||
| 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 | - $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Assign the permissions to the admin role. |
|
| 20 | - */ |
|
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['setting'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | - \DB::table('permission_role')->insert( |
|
| 23 | - [ |
|
| 24 | - 'permission_id' => $permission->id, |
|
| 25 | - 'role_id' => $adminRoleId, |
|
| 26 | - 'created_at' => \DB::raw('NOW()'), |
|
| 27 | - 'updated_at' => \DB::raw('NOW()') |
|
| 28 | - ] |
|
| 29 | - ); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 18 | + /** |
|
| 19 | + * Assign the permissions to the admin role. |
|
| 20 | + */ |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['setting'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | + \DB::table('permission_role')->insert( |
|
| 23 | + [ |
|
| 24 | + 'permission_id' => $permission->id, |
|
| 25 | + 'role_id' => $adminRoleId, |
|
| 26 | + 'created_at' => \DB::raw('NOW()'), |
|
| 27 | + 'updated_at' => \DB::raw('NOW()') |
|
| 28 | + ] |
|
| 29 | + ); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Assign the permissions to the admin role. |
| 20 | 20 | */ |
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['setting'])->each(function ($permission) use ($adminRoleId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['setting'])->each(function($permission) use ($adminRoleId) { |
|
| 22 | 22 | \DB::table('permission_role')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -6,15 +6,15 @@ |
||
| 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', ['setting']); |
|
| 17 | - \DB::table('permission_role')->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', ['setting']); |
|
| 17 | + \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | + $permissions->delete(); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -6,96 +6,96 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ApiDocumentController extends Controller |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var ReprotService |
|
| 11 | - */ |
|
| 12 | - protected $reportService; |
|
| 9 | + /** |
|
| 10 | + * @var ReprotService |
|
| 11 | + */ |
|
| 12 | + protected $reportService; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Init new object. |
|
| 16 | - * |
|
| 17 | - * @return void |
|
| 18 | - */ |
|
| 19 | - public function __construct(ReportService $reportService) |
|
| 20 | - { |
|
| 21 | - $this->reportService = $reportService; |
|
| 22 | - } |
|
| 14 | + /** |
|
| 15 | + * Init new object. |
|
| 16 | + * |
|
| 17 | + * @return void |
|
| 18 | + */ |
|
| 19 | + public function __construct(ReportService $reportService) |
|
| 20 | + { |
|
| 21 | + $this->reportService = $reportService; |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function index() |
|
| 25 | - { |
|
| 26 | - $jsonDoc = json_decode(file_get_contents(app_path('Modules/Core/Resources/api.json')), true); |
|
| 27 | - $modules = $jsonDoc['modules']; |
|
| 28 | - $reports = $jsonDoc['reports']; |
|
| 29 | - $errors = $jsonDoc['errors']; |
|
| 30 | - $models = $jsonDoc['models']; |
|
| 31 | - $conditions = [ |
|
| 32 | - [ |
|
| 33 | - 'title' => 'email equal [email protected]:', |
|
| 34 | - 'content' => ['email' => '[email protected]'] |
|
| 35 | - ], |
|
| 36 | - [ |
|
| 37 | - 'title' => 'email equal [email protected] and user is blocked:', |
|
| 38 | - 'content' => ['and' => ['email' => '[email protected]', 'blocked' => 1]] |
|
| 39 | - ], |
|
| 40 | - [ |
|
| 41 | - 'title' => 'email equal [email protected] or user is blocked:', |
|
| 42 | - 'content' => ['or' => ['email' => '[email protected]', 'blocked' => 1]] |
|
| 43 | - ], |
|
| 44 | - [ |
|
| 45 | - 'title' => 'email contain John:', |
|
| 46 | - 'content' => ['email' => ['op' => 'like', 'val' => '%John%']] |
|
| 47 | - ], |
|
| 48 | - [ |
|
| 49 | - 'title' => 'user created after 2016-10-25:', |
|
| 50 | - 'content' => ['created_at' => ['op' => '>', 'val' => '2016-10-25']] |
|
| 51 | - ], |
|
| 52 | - [ |
|
| 53 | - 'title' => 'user created between 2016-10-20 and 2016-10-25:', |
|
| 54 | - 'content' => ['created_at' => ['op' => 'between', 'val1' => '2016-10-20', 'val2' => '2016-10-25']] |
|
| 55 | - ], |
|
| 56 | - [ |
|
| 57 | - 'title' => 'user id in 1,2,3:', |
|
| 58 | - 'content' => ['id' => ['op' => 'in', 'val' => [1, 2, 3]]] |
|
| 59 | - ], |
|
| 60 | - [ |
|
| 61 | - 'title' => 'user name is null:', |
|
| 62 | - 'content' => ['name' => ['op' => 'null']] |
|
| 63 | - ], |
|
| 64 | - [ |
|
| 65 | - 'title' => 'user name is not null:', |
|
| 66 | - 'content' => ['name' => ['op' => 'not null']] |
|
| 67 | - ], |
|
| 68 | - [ |
|
| 69 | - 'title' => 'user has role admin:', |
|
| 70 | - 'content' => ['roles' => ['op' => 'has', 'val' => ['name' => 'Admin']]] |
|
| 71 | - ] |
|
| 72 | - ]; |
|
| 24 | + public function index() |
|
| 25 | + { |
|
| 26 | + $jsonDoc = json_decode(file_get_contents(app_path('Modules/Core/Resources/api.json')), true); |
|
| 27 | + $modules = $jsonDoc['modules']; |
|
| 28 | + $reports = $jsonDoc['reports']; |
|
| 29 | + $errors = $jsonDoc['errors']; |
|
| 30 | + $models = $jsonDoc['models']; |
|
| 31 | + $conditions = [ |
|
| 32 | + [ |
|
| 33 | + 'title' => 'email equal [email protected]:', |
|
| 34 | + 'content' => ['email' => '[email protected]'] |
|
| 35 | + ], |
|
| 36 | + [ |
|
| 37 | + 'title' => 'email equal [email protected] and user is blocked:', |
|
| 38 | + 'content' => ['and' => ['email' => '[email protected]', 'blocked' => 1]] |
|
| 39 | + ], |
|
| 40 | + [ |
|
| 41 | + 'title' => 'email equal [email protected] or user is blocked:', |
|
| 42 | + 'content' => ['or' => ['email' => '[email protected]', 'blocked' => 1]] |
|
| 43 | + ], |
|
| 44 | + [ |
|
| 45 | + 'title' => 'email contain John:', |
|
| 46 | + 'content' => ['email' => ['op' => 'like', 'val' => '%John%']] |
|
| 47 | + ], |
|
| 48 | + [ |
|
| 49 | + 'title' => 'user created after 2016-10-25:', |
|
| 50 | + 'content' => ['created_at' => ['op' => '>', 'val' => '2016-10-25']] |
|
| 51 | + ], |
|
| 52 | + [ |
|
| 53 | + 'title' => 'user created between 2016-10-20 and 2016-10-25:', |
|
| 54 | + 'content' => ['created_at' => ['op' => 'between', 'val1' => '2016-10-20', 'val2' => '2016-10-25']] |
|
| 55 | + ], |
|
| 56 | + [ |
|
| 57 | + 'title' => 'user id in 1,2,3:', |
|
| 58 | + 'content' => ['id' => ['op' => 'in', 'val' => [1, 2, 3]]] |
|
| 59 | + ], |
|
| 60 | + [ |
|
| 61 | + 'title' => 'user name is null:', |
|
| 62 | + 'content' => ['name' => ['op' => 'null']] |
|
| 63 | + ], |
|
| 64 | + [ |
|
| 65 | + 'title' => 'user name is not null:', |
|
| 66 | + 'content' => ['name' => ['op' => 'not null']] |
|
| 67 | + ], |
|
| 68 | + [ |
|
| 69 | + 'title' => 'user has role admin:', |
|
| 70 | + 'content' => ['roles' => ['op' => 'has', 'val' => ['name' => 'Admin']]] |
|
| 71 | + ] |
|
| 72 | + ]; |
|
| 73 | 73 | |
| 74 | - $paginateObject = [ |
|
| 75 | - 'data' => ['Array of model objects'], |
|
| 76 | - "links" => [ |
|
| 77 | - "first" => "apiUrl?page=1", |
|
| 78 | - "last" => "apiUrl?page=3", |
|
| 79 | - "prev" => "apiUrl?page=2", |
|
| 80 | - "next" => "apiUrl?page=3" |
|
| 81 | - ], |
|
| 82 | - "meta" => [ |
|
| 83 | - "current_page" => 2, |
|
| 84 | - "from" => 6, |
|
| 85 | - "last_page" => 3, |
|
| 86 | - "path" => "apiUrl", |
|
| 87 | - "per_page" => 5, |
|
| 88 | - "to" => 10, |
|
| 89 | - "total" => 15 |
|
| 90 | - ] |
|
| 91 | - ]; |
|
| 74 | + $paginateObject = [ |
|
| 75 | + 'data' => ['Array of model objects'], |
|
| 76 | + "links" => [ |
|
| 77 | + "first" => "apiUrl?page=1", |
|
| 78 | + "last" => "apiUrl?page=3", |
|
| 79 | + "prev" => "apiUrl?page=2", |
|
| 80 | + "next" => "apiUrl?page=3" |
|
| 81 | + ], |
|
| 82 | + "meta" => [ |
|
| 83 | + "current_page" => 2, |
|
| 84 | + "from" => 6, |
|
| 85 | + "last_page" => 3, |
|
| 86 | + "path" => "apiUrl", |
|
| 87 | + "per_page" => 5, |
|
| 88 | + "to" => 10, |
|
| 89 | + "total" => 15 |
|
| 90 | + ] |
|
| 91 | + ]; |
|
| 92 | 92 | |
| 93 | - $responseObject = [ |
|
| 94 | - 'data' => ['The model object'] |
|
| 95 | - ]; |
|
| 93 | + $responseObject = [ |
|
| 94 | + 'data' => ['The model object'] |
|
| 95 | + ]; |
|
| 96 | 96 | |
| 97 | - $avaialableReports = $this->reportService->all(); |
|
| 97 | + $avaialableReports = $this->reportService->all(); |
|
| 98 | 98 | |
| 99 | - return view('core::doc', ['modules' => $modules, 'reports' => $reports, 'errors' => $errors, 'conditions' => $conditions, 'models' => $models, 'paginateObject' => json_encode($paginateObject, JSON_PRETTY_PRINT), 'responseObject' => json_encode($responseObject, JSON_PRETTY_PRINT), 'avaialableReports' => $avaialableReports]); |
|
| 100 | - } |
|
| 99 | + return view('core::doc', ['modules' => $modules, 'reports' => $reports, 'errors' => $errors, 'conditions' => $conditions, 'models' => $models, 'paginateObject' => json_encode($paginateObject, JSON_PRETTY_PRINT), 'responseObject' => json_encode($responseObject, JSON_PRETTY_PRINT), 'avaialableReports' => $avaialableReports]); |
|
| 100 | + } |
|
| 101 | 101 | } |
@@ -5,29 +5,29 @@ |
||
| 5 | 5 | |
| 6 | 6 | class SettingService extends BaseService |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Init new object. |
|
| 10 | - * |
|
| 11 | - * @param SettingRepository $repo |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function __construct(SettingRepository $repo) |
|
| 15 | - { |
|
| 16 | - parent::__construct($repo); |
|
| 17 | - } |
|
| 8 | + /** |
|
| 9 | + * Init new object. |
|
| 10 | + * |
|
| 11 | + * @param SettingRepository $repo |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function __construct(SettingRepository $repo) |
|
| 15 | + { |
|
| 16 | + parent::__construct($repo); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Save list of settings. |
|
| 21 | - * |
|
| 22 | - * @param array $data |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function saveMany(array $data) |
|
| 26 | - { |
|
| 27 | - \DB::transaction(function () use ($data) { |
|
| 28 | - foreach ($data as $value) { |
|
| 29 | - $this->repo->save($value); |
|
| 30 | - } |
|
| 31 | - }); |
|
| 32 | - } |
|
| 19 | + /** |
|
| 20 | + * Save list of settings. |
|
| 21 | + * |
|
| 22 | + * @param array $data |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function saveMany(array $data) |
|
| 26 | + { |
|
| 27 | + \DB::transaction(function () use ($data) { |
|
| 28 | + foreach ($data as $value) { |
|
| 29 | + $this->repo->save($value); |
|
| 30 | + } |
|
| 31 | + }); |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function saveMany(array $data) |
| 26 | 26 | { |
| 27 | - \DB::transaction(function () use ($data) { |
|
| 27 | + \DB::transaction(function() use ($data) { |
|
| 28 | 28 | foreach ($data as $value) { |
| 29 | 29 | $this->repo->save($value); |
| 30 | 30 | } |
@@ -6,27 +6,27 @@ |
||
| 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 | - $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Assign the permissions to the admin role. |
|
| 20 | - */ |
|
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | - \DB::table('permission_role')->insert( |
|
| 23 | - [ |
|
| 24 | - 'permission_id' => $permission->id, |
|
| 25 | - 'role_id' => $adminRoleId, |
|
| 26 | - 'created_at' => \DB::raw('NOW()'), |
|
| 27 | - 'updated_at' => \DB::raw('NOW()') |
|
| 28 | - ] |
|
| 29 | - ); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 18 | + /** |
|
| 19 | + * Assign the permissions to the admin role. |
|
| 20 | + */ |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | + \DB::table('permission_role')->insert( |
|
| 23 | + [ |
|
| 24 | + 'permission_id' => $permission->id, |
|
| 25 | + 'role_id' => $adminRoleId, |
|
| 26 | + 'created_at' => \DB::raw('NOW()'), |
|
| 27 | + 'updated_at' => \DB::raw('NOW()') |
|
| 28 | + ] |
|
| 29 | + ); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Assign the permissions to the admin role. |
| 20 | 20 | */ |
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function ($permission) use ($adminRoleId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function($permission) use ($adminRoleId) { |
|
| 22 | 22 | \DB::table('permission_role')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -6,15 +6,15 @@ |
||
| 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', ['report']); |
|
| 17 | - \DB::table('permission_role')->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', ['report']); |
|
| 17 | + \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | + $permissions->delete(); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -5,14 +5,14 @@ discard block |
||
| 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, roles g ,role_user ug |
| 18 | 18 | where |
@@ -20,25 +20,25 @@ discard block |
||
| 20 | 20 | ug.role_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 | } |