<?php

namespace App\Http\Controllers\Admin\Pages\Emails;

use App\Http\Controllers\Controller;
use App\Models\Email;
use App\Models\Speed;
use App\Http\Requests\Tickets\TicketStoreRequest;
use App\Http\Requests\Tickets\TicketUpdateRequest;
use App\Models\Ticket;
use App\Traits\ImageCompressor;
use Exception;


class EmailController extends Controller
{
    use ImageCompressor;


    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        $emails =Email::all();
        return view('app.admin.pages.messages.all-emails',compact([
            'emails'
        ]));
    }

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

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




    /**
     * Display the specified resource.
     */
    public function show(Ticket $ticket)
    {
        //
    }

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

    /**
     * Update the specified resource in storage.
     */
    public function update(TicketUpdateRequest $request, Ticket $ticket)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy($id)
    {
        try {
            $email=Email::find($id);
            $email->delete();

            return back()->with('success', __('Data successfully deleted!'));
        } catch (Exception $e) {
            return back()->withErrors([$e->getMessage()]);
        }
    }

}
