-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
255 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
namespace Mekaeil\LaravelUserManagement\seeders\User; | ||
|
||
use Illuminate\Database\Seeder; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class MasterUserTableSeeder extends Seeder | ||
{ | ||
protected $roles = []; | ||
protected $roleRepository; | ||
|
||
public function __construct() | ||
{ | ||
|
||
} | ||
|
||
protected function getRoles() | ||
{ | ||
return $this->roles; | ||
} | ||
|
||
/** | ||
* Run the database seeds. | ||
* | ||
* @return void | ||
*/ | ||
public function run() | ||
{ | ||
Model::unguard(); | ||
|
||
$this->command->info('============================================================='); | ||
$this->command->info(' USER MODULE: INSERT ROLES DATA'); | ||
$this->command->info('============================================================='); | ||
$this->command->info("\n"); | ||
|
||
foreach ($this->getRoles() as $role) | ||
{ | ||
$findRole = Role::where('name',$role['name']) | ||
->where('guard_name',$role['guard_name']) | ||
->first(); | ||
|
||
if ($findRole) | ||
{ | ||
$this->command->info('THIS ROLE << ' . $role['name'] .'['. $role['guard_name'] . '] >> EXISTED! UPDATING DATA ...'); | ||
|
||
|
||
$findRole->update([ | ||
'name' => $role['name'], | ||
'display_name' => $role['display_name'], | ||
'guard_name' => $role['guard_name'], | ||
'description' => isset($role['description']) ? $role['description'] : null, | ||
]); | ||
|
||
continue; | ||
} | ||
|
||
$this->command->info('CREATING THIS ROLE <<' . $role['name'] .'['. $role['guard_name'] . '] >> ...'); | ||
|
||
Role::create([ | ||
'name' => $role['name'], | ||
'display_name' => $role['display_name'], | ||
'guard_name' => $role['guard_name'], | ||
'description' => isset($role['description']) ? $role['description'] : null, | ||
]); | ||
|
||
} | ||
|
||
Cache::forget('roles'); | ||
Cache::rememberForever('roles', function () { | ||
return \DB::table('roles')->get()->pluck('id', 'name')->toArray(); | ||
}); | ||
|
||
$this->command->info("\n"); | ||
$this->command->info('============================================================='); | ||
$this->command->info(' INSERTING ROLES FINALIZED!'); | ||
$this->command->info('============================================================='); | ||
$this->command->info("\n"); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Seeder; | ||
use Mekaeil\LaravelUserManagement\seeders\User\MasterUserTableSeeder; | ||
|
||
class UserTableSeeder extends MasterUserTableSeeder | ||
{ | ||
protected $permissions = [ | ||
[ | ||
'first_name' => '', | ||
|
||
], | ||
|
||
]; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Entities; | ||
use Mekaeil\LaravelUserManagement\Entities\Department as UserManagementDepartment; | ||
|
||
class Department extends UserManagementDepartment | ||
{ | ||
protected $fillable = [ | ||
'title', | ||
'slug', | ||
'parent_id', | ||
]; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace App\Entities; | ||
use Mekaeil\LaravelUserManagement\Entities\Permission as UserManagementPermission; | ||
|
||
class Permission extends UserManagementPermission | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace App\Entities; | ||
use Mekaeil\LaravelUserManagement\Entities\Role as UserManagementRole; | ||
|
||
class Role extends UserManagementRole | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\Entities; | ||
use Mekaeil\LaravelUserManagement\Entities\User as UserManagement; | ||
|
||
class User extends UserManagement | ||
{ | ||
protected $fillable = [ | ||
'first_name', | ||
'last_name', | ||
'email', | ||
'mobile', | ||
'password', | ||
'status', | ||
'email_verified', | ||
'mobile_verified', | ||
]; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.