<?php

namespace App\Exports;

use App\Models\User;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;

class UsersExport implements FromView, ShouldAutoSize
{
    public function view(): View
    {
        $users = User::with('karyawan')
            ->orderBy('name')
            ->get();

        return view('exports.users', [
            'users' => $users
        ]);
    }
}
