Delete database/seeds directory
This commit is contained in:
parent
f3e99daa8a
commit
8cea04208a
2 changed files with 0 additions and 73 deletions
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->call(PermissionSeeder::class);
|
||||
$user = User::create([
|
||||
'firstname' => 'Admin',
|
||||
'surname' => '',
|
||||
'email' => 'admin@localhost',
|
||||
'password' => Hash::make('admin'),
|
||||
]);
|
||||
|
||||
DB::table('users')->where('id', $user->id)->update([
|
||||
'email_verified_at' => DB::raw('CURRENT_TIMESTAMP')
|
||||
]);
|
||||
|
||||
$user->assignRole('administrator');
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$permissions = Permission::select('name')->get();
|
||||
$array = [
|
||||
'roles_see', 'roles_edit',
|
||||
'status_see', 'status_edit',
|
||||
'project_see', 'project_edit',
|
||||
'user_see', 'user_edit',
|
||||
'order_see', 'order_edit'
|
||||
];
|
||||
|
||||
foreach($array as $name) {
|
||||
if($permissions->contains('name', $name))
|
||||
continue;
|
||||
|
||||
Permission::create([
|
||||
'name' => $name
|
||||
]);
|
||||
}
|
||||
|
||||
$role = Role::create([
|
||||
'name' => 'administrator',
|
||||
'readable_name' => 'Administrator',
|
||||
'color' => '#e74c3c',
|
||||
'index' => 1
|
||||
]);
|
||||
|
||||
$role->syncPermissions($array);
|
||||
}
|
||||
}
|
Reference in a new issue