<?php

namespace App\Http\Controllers;

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

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

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

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

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