<?php

namespace App\Http\Controllers;

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

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

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

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