<?php
namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Permission;

class PermissionSeeder extends Seeder
{
  /**
   * Run the database seeds.
   *
   * @return void
   */
  public function run()
  {
    $permissions = [
      ['name'=>'Create User', 'category'=>'Users', 'details'=>'Create New Users'],
      ['name'=>'Edit User', 'category'=>'Users', 'details'=>'Edit Existing Users'],
      ['name'=>'Delete User', 'category'=>'Users', 'details'=>'Delete Existing Users'],
      ['name'=>'Reset Password', 'category'=>'Users', 'details'=>'Change User\'s Password'],
      ['name'=>'Assign Role', 'category'=>'Users', 'details'=>'Add/Remove Roles to/from Users'],

      ['name'=>'Create Role', 'category'=>'Roles', 'details'=>'Create New Roles'],
      ['name'=>'Edit Role', 'category'=>'Roles', 'details'=>'Edit Existing Roles'],
      ['name'=>'Delete Role', 'category'=>'Roles', 'details'=>'Delete Existing Roles'],

      ['name'=>'Edit Recipe', 'category'=>'Recipes', 'details'=>'Edit Recipes from other Users'],
      ['name'=>'Delete Recipe', 'category'=>'Recipes', 'details'=>'Delete Recipes from other Users'],
    ];
    foreach ($permissions as $key => $value) {
      Permission::updateOrCreate($value);
    }
  }
}
