<?php
namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Laravolt\Avatar\Avatar;
use Illuminate\Support\Facades\Storage;
class SchoolsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Create super admin account
        $user = \App\User::create([
            'name' => 'SuperAdmin',
            'email' => 'superadmin@sburk.com',
            'password' => bcrypt('admin'),
            'is_super_admin_account' => 1,
            'avatar' => 'avatar.png',
            'tel_number' => '',
            'country_code' => ''
        ]);

        $avatar = (new Avatar())->create($user->name)->getImageObject()->encode('png');
        Storage::put('avatars/'.$user->id.'/avatar.png', (string) $avatar);
    }
}
