Inheritance: extends Illuminate\Database\Eloquent\Model, implements Illuminate\Contracts\Auth\Authenticatable, use trait Illuminate\Auth\Authenticatable
Ejemplo n.º 1
0
 /**
  * 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']]);
 }
Ejemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     $this->user = Administrator::first();
     $this->be($this->user, 'admin');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Administrator::truncate();
     Administrator::create(['username' => 'admin', 'password' => bcrypt('admin'), 'name' => 'Administrator']);
 }