<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;

class pro_program_SINGLE_Controller extends Controller
{
    public $selfName = 'pro_program_SINGLE_Controller';
    public $dashboardName = 'dashboard';

	// GET /pro_program/view/{uid}/ACTION_remove
	public function ACTION_remove(Request $request, $uid) {
		$record = DB::table('pro_program')->where('uid', $uid)->first();
		if(!$record) {
			$record = DB::table('pro_program')->where('id', $uid)->first();
			if($record) return redirect('/pro_program/view/' . $record->uid . '/ACTION_remove');
		}
		return response()->view('admin/pro_program_SINGLE/ACTION_remove', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
	}

	// GET /pro_program/view/{uid}/SUB_dashboard
	public function SUB_dashboard(Request $request, $uid) {
		$record = DB::table('pro_program')->where('uid', $uid)->first();
		if(!$record) {
			$record = DB::table('pro_program')->where('id', $uid)->first();
			if($record) return redirect('/pro_program/view/' . $record->uid . '/SUB_dashboard');
		}
		return response()->view('admin/pro_program_SINGLE/SUB_dashboard', compact('record'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
	}
}
