<?php

namespace App\Http\Controllers;

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

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

	// GET /notes
	public function index(Request $request) {
		$records = DB::table('note')->get();
		$result_pros = DB::select("SELECT id, concat(name_last, ', ', name_first) as name_display FROM pro");
		$result_clients = DB::select("SELECT id, concat(name_last, ', ', name_first) as name_display FROM client");
		$result_reasons = DB::select("SELECT id, concat(reason1, reason2) as result FROM note");
		return response()->view('pro/notes/index', compact('records', 'result_pros', 'result_clients', 'result_reasons'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
	}

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