<?php

namespace App\Http\Controllers;

use App\Models\AudienceFile;
use Illuminate\Http\Request;

class AudienceFileController extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        //
         $files = AudienceFile::with([
                'appointment',
                'report',
                'opener',
                'appointment.service'
            ])
            ->latest()
            ->paginate(10);

        return view('admin.audience-files.index', ["files"=>$files]);
    }

    /**
     * Show the form for creating a new resource.
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     */
    public function show($id)
    {
        //
        $audienceFile = AudienceFile::findOrFail($id);
        $report= $audienceFile->report;
        $appointment= $audienceFile->appointment;
        $technical_request =$audienceFile->technicalRequests;
        return view('admin.audience-files.show', [
            'report' => $report,
            'appointment' => $appointment,
            'technical' => $technical_request,
            'audienceFile'=> $audienceFile

        ]);
    }

    

    /**
     * Show the form for editing the specified resource.
     */
    public function edit(AudienceFile $audienceFile)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     */
    public function update(Request $request, AudienceFile $audienceFile)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy(AudienceFile $audienceFile)
    {
        //
    }
}
