1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace App\Http\Controllers\Admin;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use App\Models\Admin;
- use Auth;
- use Mail;
- use Session;
- use DB;
- class AjaxController extends Controller
- {
- public function __construct()
- {
- $this->middleware('admin');
- $this->api_base_url = apiUrl();
- }
- public function ajaxGET(Request $request, $name){
- $loggedin = Auth::guard('admin')->user();
- if($name == 'sams_institutes'){
- $destination = $request->destination;
- $type = $request->type;
- $data = getApiRequest($this->api_base_url.'api/sams-institutes/v1/get-institutes?destination='.$destination.'&type='.$type);
- return $data;
- }elseif($name == 'sams_levels'){
- $institute = $request->institute;
- $group = $request->group;
- $data = getApiRequest($this->api_base_url.'api/sams-institutes/v1/get-levels?institute='.$institute.'&group='.$group);
- return $data;
- }elseif($name == 'sams_campuses'){
- $institute = $request->institute;
- $data = getApiRequest($this->api_base_url.'api/sams-institutes/v1/get-campuses?institute='.$institute);
- return $data;
- }elseif($name == 'sams_intakes'){
- $institute = $request->institute;
- $level = $request->level;
- $data = getApiRequest($this->api_base_url.'api/sams-institutes/v1/get-intakes?institute='.$institute.'&level='.$level);
- return $data;
- }else{
- return response([
- 'msg'=>'Wrong Request! nothing to load.'
- ], 403);
- }
- return view('admin.admins.list',compact('admins'));
- }
- }
|