88 lines
2.0 KiB
PHP
88 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Models\Unit;
|
|
use App\Models\Constituency;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('auth');
|
|
}
|
|
|
|
/**
|
|
* Show the application dashboard.
|
|
*
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
*/
|
|
public function index()
|
|
{
|
|
return view('home');
|
|
}
|
|
|
|
/**
|
|
* Show the rmto index.
|
|
*
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
*/
|
|
public function rmtoIndex()
|
|
{
|
|
if (Auth::user()->id >= 801
|
|
&& Auth::user()->id <= 870
|
|
&& Auth::user()->confirmed == 0) {
|
|
$confirmed = 0;
|
|
} elseif (Auth::user()->id >= 713
|
|
&& Auth::user()->id <= 757
|
|
&& Auth::user()->confirmed == 0) {
|
|
$confirmed = 0;
|
|
} elseif (Auth::user()->id > 470) {
|
|
$confirmed = 1;
|
|
} elseif (Auth::user()->province_id != null
|
|
&& Auth::user()->city_id == null
|
|
&& Auth::user()->confirmed == 0) {
|
|
$confirmed = 0;
|
|
} else {
|
|
if ((
|
|
Auth::user()->username == 'test'
|
|
|| Auth::user()->username == 'drdanesh'
|
|
) && Auth::user()->confirmed == 0) {
|
|
$confirmed = 0;
|
|
} else {
|
|
$confirmed = 1;
|
|
}
|
|
}
|
|
|
|
return view('rmto-preview.home', ['confirmed' => $confirmed]);
|
|
}
|
|
|
|
public function getUnits()
|
|
{
|
|
dd();
|
|
$data = Unit::all();
|
|
|
|
return response()->json([
|
|
'message' => 'success',
|
|
'data' => $data
|
|
]);
|
|
}
|
|
|
|
public function getConstituencies()
|
|
{
|
|
$data = Constituency::all();
|
|
|
|
return response()->json([
|
|
'message' => 'success',
|
|
'data' => $data
|
|
]);
|
|
}
|
|
}
|