/** * Run the database seeds. * * @return void */ public function run() { // create a user. Administrator::truncate(); Administrator::create(['username' => 'admin', 'password' => bcrypt('admin'), 'name' => 'Administrator']); // create a role. Role::truncate(); Role::create(['name' => 'Administrator', 'slug' => 'administrator']); // add role to user. Administrator::first()->roles()->sync(Role::first()->toArray()); // add default menus. Menu::truncate(); Menu::insert([['parent_id' => 0, 'order' => 1, 'title' => 'Index', 'icon' => 'fa-bar-chart', 'uri' => '/'], ['parent_id' => 0, 'order' => 2, 'title' => 'Auth', 'icon' => 'fa-tasks', 'uri' => ''], ['parent_id' => 2, 'order' => 3, 'title' => 'Users', 'icon' => 'fa-users', 'uri' => 'auth/users'], ['parent_id' => 2, 'order' => 4, 'title' => 'Roles', 'icon' => 'fa-user', 'uri' => 'auth/roles'], ['parent_id' => 2, 'order' => 5, 'title' => 'Permission', 'icon' => 'fa-user', 'uri' => 'auth/permissions'], ['parent_id' => 2, 'order' => 6, 'title' => 'Menu', 'icon' => 'fa-bars', 'uri' => 'auth/menu']]); }
public function setUp() { parent::setUp(); $this->user = Administrator::first(); $this->be($this->user, 'admin'); }