1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Http\Controllers;
- use App\Models\CareMonth;
- use App\Models\CareMonthEntry;
- use App\Models\Client;
- use App\Models\Handout;
- use App\Models\HandoutClient;
- use App\Models\Pro;
- use App\Models\Section;
- use App\Models\SectionTemplate;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\File;
- use Illuminate\Support\Facades\Response;
- class GuestController extends Controller
- {
- public function section(Request $request, $guestAccessCode )
- {
- $section = Section::where('guest_access_code', $guestAccessCode)->first();
- abort_if(!$section, 404, 'Invalid access code');
- abort_if(!$section->is_active, 404, 'Invalid access code');
- abort_if($section->guest_access_level == 'NONE', 401, 'Invalid access code');
- $patient = null;
- if($section->note){
- $patient = $section->note->client;
- }else{
- $patient = $section->client;
- }
- return view('app.guest.section', compact('patient','section', 'guestAccessCode'));
- }
- public function handout(Request $request, $handoutClientUid )
- {
- $handoutClient = HandoutClient::where('uid', $handoutClientUid)->first();
- abort_if((!$handoutClient || !$handoutClient->is_active), 404, 'Invalid access code');
- $handout = Handout::where('id', $handoutClient->handout_id)->first();
- abort_if((!$handout || !$handout->is_active), 404, 'Invalid access code');
- return Response::download(
- $handout->pdf_file_path,
- $handout->internal_name . '.pdf',
- ['Content-Type: application/pdf']
- );
- }
- }
|