<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class PushAuthData extends Migration
{
  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
    $data = [[
      'name' => 'admin_basics',
      'title' => '后台基础接口',
      'icon' => '',
      'pid' => '0',
      'type' => '1',
      'check_type' => '1',
      'show' => '2',
    ], [
      'name' => 'admin_basics_login',
      'title' => '后台登录',
      'icon' => '',
      'pid' => '1',
      'type' => '2',
      'check_type' => '1',
      'show' => '2',
    ], [
      'name' => 'admin',
      'title' => '管理员设置',
      'icon' => 'every-user',
      'pid' => '0',
      'type' => '1',
      'check_type' => '1',
      'show' => '1',
    ], [
      'name' => 'admin-info',
      'title' => '个人设置',
      'icon' => 'user',
      'pid' => '3',
      'type' => '2',
      'check_type' => '1',
      'show' => '1',
    ], [
      'name' => 'admin-auth',
      'title' => '权限管理',
      'icon' => 'personal-privacy',
      'pid' => '3',
      'type' => '2',
      'check_type' => '2',
      'show' => '1',
    ], [
      'name' => 'admin-list',
      'title' => '管理员列表',
      'icon' => 'every-user',
      'pid' => '3',
      'type' => '2',
      'check_type' => '2',
      'show' => '1',
    ], [
      'name' => 'settings',
      'title' => '后台管理',
      'icon' => 'setting',
      'pid' => '0',
      'type' => '1',
      'check_type' => '1',
      'show' => '1',
    ], [
      'name' => 'settings-config',
      'title' => '后台配置',
      'icon' => 'setting-config',
      'pid' => '7',
      'type' => '2',
      'check_type' => '2',
      'show' => '1',
    ], [
      'name' => 'settings-router',
      'title' => '路由配置',
      'icon' => 'left-and-right-branch',
      'pid' => '7',
      'type' => '2',
      'check_type' => '2',
      'show' => '1',
    ]];
    foreach ($data as $datum) {
      $auth = new App\Models\Auth();
      $auth->name = $datum['name'];
      $auth->title = $datum['title'];
      $auth->icon = $datum['icon'];
      $auth->pid = $datum['pid'];
      $auth->type = $datum['type'];
      $auth->check_type = $datum['check_type'];
      $auth->show = $datum['show'];
      $auth->status = 1;
      $auth->del = 2;
      $auth->order = 0;
      $auth->save();
    }
  }

  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
    //
  }
}
