<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use App\Models\Department;
use App\Models\University;
use Auth;
class HomeController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
       // $this->middleware('auth');
    }


    public function student_q_form($hash)
    {
        $hashids=new \Hashids\Hashids('student_q_signup', 25);
        $hash_teacher_ids=$hashids->decode($hash);
        $user =User::find($hash_teacher_ids[0]);
        if(empty($hash_teacher_ids[0])) abort(404);
        return view('Q_apply_form',compact('hash_teacher_ids','user'));
    }

    public function q_apply_register_form($hash)
    {
        $hashids=new \Hashids\Hashids('student_wishlist_signup', 25);
        $hash_student_ids=$hashids->decode($hash);
        if(empty($hash_student_ids[0])) abort(404);
        $user =User::find($hash_student_ids[0]);
        return view('auth.q_apply_register_form',compact('hash_student_ids','user'));
    }

    public function invited_register_form($hash)
    {
        $hashids=new \Hashids\Hashids('teacher_invitation_signup', 25);
        $hash_ids=$hashids->decode($hash);
        if(empty($hash_ids[0])) abort(404);
        $user =User::find($hash_ids[0]);
        $departments =Department::where('status',1)->orderBy('name','ASC')->get();
        $universities =University::orderBy('name','ASC')->get();
        return view('auth.invited_register_form',compact('hash_ids','user','departments','universities'));
    }


}
