Skip to content

Commit

Permalink
Updating the Table Seeders
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Sep 24, 2016
1 parent a4bd787 commit fd43b26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Seeds/Foundation/RoleTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function run()
],
[
'name' => 'Moderator',
'description' => 'The moderator role.',
'description' => 'The system moderator role.',
'is_locked' => true,
],
[
Expand Down
4 changes: 2 additions & 2 deletions src/Seeds/Foundation/UserTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ public function run()
*/
private function seedAdminUser()
{
/** @var \Arcanesoft\Auth\Models\Role $adminRole */
$adminRole = Role::admins()->first();
$adminUser = new User([
'username' => 'admin',
'first_name' => 'Super',
Expand All @@ -55,6 +53,8 @@ private function seedAdminUser()

$adminUser->save();

/** @var \Arcanesoft\Auth\Models\Role $adminRole */
$adminRole = Role::admin()->first();
$adminRole->attachUser($adminUser);
}
}
6 changes: 3 additions & 3 deletions src/Seeds/RolesSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Arcanesoft\Auth\Models\Permission;
use Arcanesoft\Auth\Models\Role;
use Carbon\Carbon;
use Illuminate\Support\Str;

/**
* Class RolesSeeder
Expand Down Expand Up @@ -47,7 +48,7 @@ protected function prepareRoles(array $roles)
$now = Carbon::now();

foreach ($roles as $key => $role) {
$roles[$key]['slug'] = str_slug($role['name']);
$roles[$key]['slug'] = Str::slug($role['name'], config('arcanesoft.auth.slug-separator', '.'));
$roles[$key]['is_active'] = isset($role['is_active']) ? $role['is_active'] : true;
$roles[$key]['is_locked'] = isset($role['is_locked']) ? $role['is_locked'] : true;
$roles[$key]['created_at'] = $now;
Expand All @@ -63,8 +64,7 @@ protected function prepareRoles(array $roles)
protected function syncAdminRole()
{
/** @var \Arcanesoft\Auth\Models\Role $admin */
$admin = Role::admins()->first();

$admin = Role::admin()->first();
$admin->permissions()->sync(
Permission::all()->pluck('id')->toArray()
);
Expand Down

0 comments on commit fd43b26

Please sign in to comment.