<?php

namespace App\Http\Controllers;

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

class my_clients_Controller extends Controller
{
    public $selfName = 'my_clients_Controller';

	// GET /my_clients
	public function index(Request $request) {
		$records = DB::table('client')->get();
		$result_pros = DB::select("SELECT id, name_display FROM pro");
		return response()->view('pro/my_clients/index', compact('records', 'result_pros'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
	}

	// GET /my_clients/add_new
	public function add_new(Request $request) {
		$records = DB::table('client')->get();
		$result_pros = DB::select("SELECT uid, name_display FROM pro");
		return response()->view('pro/my_clients/add_new', compact('records', 'result_pros'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
	}

	// GET /my_clients/view/{uid}
	public function view(Request $request, $uid) {
		return redirect("/my_clients/view/$uid/SUB_dashboard");
	}
}
