|
@@ -2,39 +2,53 @@
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
+use App\Lib\Backend;
|
|
|
use App\Models\Meeting;
|
|
|
use App\Models\MeetingParticipant;
|
|
|
use Illuminate\Http\Request;
|
|
|
use App\Models\Pro;
|
|
|
+use Illuminate\Support\Facades\Cookie;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class GuestController extends Controller
|
|
|
{
|
|
|
|
|
|
- // old meeting
|
|
|
- /*
|
|
|
- public function meeting(Request $request, $meetingID, $participantID) {
|
|
|
- $meeting = Meeting::where('uid', $meetingID)->first();
|
|
|
- if(!$meeting) {
|
|
|
- return abort(404, "Meeting no longer active");
|
|
|
- }
|
|
|
- $participants = MeetingParticipant::where('meeting_id', $meeting->id)->get();
|
|
|
- foreach ($participants as $participant) {
|
|
|
- $participant->proName = $participant->proName(); // eager-fill proName
|
|
|
- }
|
|
|
- return view('meeting', [
|
|
|
- 'meetingID' => $meetingID,
|
|
|
- 'participantID'=> $participantID,
|
|
|
- 'participants' => $participants,
|
|
|
- 'guest' => true
|
|
|
- ]);
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
public function join(Request $request) {
|
|
|
return view('join');
|
|
|
}
|
|
|
|
|
|
+ public function processJoin(Request $request) {
|
|
|
+
|
|
|
+ $api = new Backend();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ $apiResponse = $api->post('client/createAsGuest', [
|
|
|
+ 'nameFirst' => $request->post('nameFirst'),
|
|
|
+ 'nameLast' => $request->post('nameLast'),
|
|
|
+ 'dob' => $request->post('dob'),
|
|
|
+ 'medicareNumber' => $request->post('medicareNumber'),
|
|
|
+ 'cellNumber' => $request->post('cellNumber'),
|
|
|
+ 'emailAddress' => $request->post('emailAddress'),
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $data = json_decode($apiResponse->getContents());
|
|
|
+
|
|
|
+ if (!property_exists($data, 'success') || !$data->success) {
|
|
|
+ return back()->with('message', $data->message)
|
|
|
+ ->withInput($request->input());
|
|
|
+ }
|
|
|
+
|
|
|
+ Cookie::queue('sessionKey', $data->data->sessionKey);
|
|
|
+ Cookie::queue('clientUid', $data->data->clientUid);
|
|
|
+
|
|
|
+ return redirect('/client/dashboard');
|
|
|
+
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return redirect()->back()->with('message', $e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function checkin(Request $request) {
|
|
|
return view('checkin');
|
|
|
}
|
|
@@ -46,7 +60,7 @@ class GuestController extends Controller
|
|
|
}
|
|
|
|
|
|
public function dashboard(Request $request) {
|
|
|
- $clientUid = $_COOKIE['clientUid'];
|
|
|
+ $clientUid = $request->cookie('clientUid');
|
|
|
$client = DB::table('client')->where('uid', $clientUid)->first();
|
|
|
return view('client-dashboard', [
|
|
|
"client" => $client
|