<?php

use Illuminate\Database\Seeder;

class RoleSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $role = factory(App\Models\Role::class)->create([
            'name'        => 'Admin',
            'description' => 'Admin',
            'created_by'  => factory(App\User::class)
        ]);
        $role->permissions()->attach(App\Models\Permission::all());

        $role = factory(App\Models\Role::class)->create([
            'name'        => 'Teacher',
            'description' => 'Teacher',
            'created_by'  => factory(App\User::class)
        ]);
        $role->permissions()->attach([1,6,7, 8, 10, 11, 12, 13, 14, 22]);

        $role = factory(App\Models\Role::class)->create([
            'name'        => 'Accountant',
            'description' => 'Accountant',
            'created_by'  => factory(App\User::class)
        ]);
        $role->permissions()->attach([1]);

        $role = factory(App\Models\Role::class)->create([
            'name'        => 'Librarian',
            'description' => 'Librarian',
            'created_by'  => factory(App\User::class)
        ]);
        $role->permissions()->attach([1]);

        $role = factory(App\Models\Role::class)->create([
            'name'        => 'Student',
            'description' => 'Student',
            'created_by'  => factory(App\User::class)
        ]);
        $role->permissions()->attach([1, 23, 11, 7]);


//        factory(Role::class, 5)->create();
    }
}
