<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Ticket;
use App\Models\Company;
use App\Models\User;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;

class DashboardController extends Controller
{
    public function dashboard()
    {
        $tickets =  get_current_company_tickets(['type' => 'inbox']);
        return view('index', ['tickets' => $tickets]);
    }
    
    public function profile()
    {
        $company = getSelectedCompany();
        $users = $users = User::where('role_id', '!=', 1)
            //->where('id', '!=', Auth::id())
            ->join('company_users', 'users.id', '=', 'company_users.user_id')
            ->where('company_users.company_id', $company)
            ->select('users.*')
            ->get();
        return view('profile', ['users' => $users]);
    }
}
