123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?php
- namespace App\Http\Controllers\Admin;
- use App\Http\Controllers\Controller;
- use Illuminate\Http\Request;
- use App\User;
- use App\Country;
- use App\Models\MarketCountry;
- use App\Models\ReferUser;
- use App\StudentProposal;
- use App\Models\University;
- use Auth;
- use Mail;
- use Session;
- use Hash;
- class AdminController extends Controller
- {
- public function __construct(){
- $this->middleware('admin');
- }
- public function dashboard()
- {
- $admin = Auth::guard('admin')->user();
- $register_active_teachers_list =User::where(
- 'apply_status',1
- )->where(
- 'sign_up',1
- )->where(
- 'user_type',2
- )->orderBy(
- 'registered_date','DESC'
- )->get();
- $pending_student_list =User::where(
- 'user_type',1
- )->where(
- 'sign_up',0
- )->where(
- 'register_type',4
- )->orderBy(
- 'id','DESC'
- )->get();
- $register_student_list =User::where(
- 'user_type',1
- )->where(
- 'sign_up',1
- )->orderBy(
- 'id','DESC'
- )->get();
- $invited_registered_list =User::where(
- 'user_type',2
- )->whereNotNull(
- 'admin_invite_id'
- )->where(
- 'register_type',1 //1=teacher invitation
- )->orderBy(
- 'id','DESC'
- )->get();
- $landing_wishlist =User::where(
- 'user_type',2
- )->where(
- 'register_type',2 // 2=teacher landing
- )->orderBy(
- 'id','DESC'
- )->get();
- $market_countries = MarketCountry::where(
- 'status', 1
- )->select(
- 'market_countries.*', \DB::raw('(SELECT name FROM countries WHERE market_countries.country_id = countries.id ) as sort')
- )->orderBy('sort')->get();
- $student_refer_friend_list =User::where(
- 'register_type',6 // 6 = student refer a friend for a proposal
- )->where(
- 'user_type',1
- )->orderBy('id','DESC')->get();
- $application = StudentProposal::where(
- 'proposal_submit_status',1
- )->orderBy('id','DESC')->get();
- $data =[
- 'register_active_teachers_list'=>$register_active_teachers_list,
- 'register_student_list'=>$register_student_list ,
- 'market_countries'=>$market_countries,
- 'refer_users'=>$student_refer_friend_list,
- 'invited_registered_list'=>$invited_registered_list,
- 'application'=>$application,
- 'landing_wishlist'=>$landing_wishlist,
- 'pending_student_list'=>$pending_student_list,
- 'admin'=>$admin
- ];
- return view('admin.admin_profile',$data);
- }
- public function load_country_list($text){
- $selected = MarketCountry::pluck('country_id')->toArray();
- if($text == '0'){
- $countries = Country::where('status', 1)->paginate(10);
- }else{
- $countries = Country::where('status', 1)->where('name','like', '%'.$text.'%')->paginate(10);
- }
- return view('admin.loadCountry', compact('countries','selected'));
- }
- public function destination_wise_university(Request $request){
- $universities = University::where(
- 'country_id',$request->country_id
- )->orderBy(
- 'name'
- )->select(
- 'id','name'
- )->get();
- return [
- 'msg'=>'Destination wise university data',
- 'data'=>[
- 'universities'=>$universities
- ]
- ];
- }
- }
|