<?php

namespace App\Http\Controllers\inside;

use App\MailLog;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class MailsLogController extends Controller
{
    public function index(){
        return view('Inside.mailsLog');
    }
    public function mails(Request $request)
    {
        switch($request->input('action')){
            case "query":
                $mails=MailLog::all();
                $count = 1;
                foreach ($mails as $value) 
                {
                    $value->number = $count++;
                    $date = new DateTime($value->created_at);
                    $value->date = $date->format('d-m-Y');
                }
                return $mails;
                break;
                default:
                break;
        }
    }
}
