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:
EmailController.php
<?php namespace App\Http\Controllers; use App\Models\Email; use App\Repositories\EmailRepository; use Illuminate\Http\Request; use App\Models\File; use Illuminate\Support\Facades\Storage; use Exception; class EmailController extends Controller { protected EmailRepository $repository; public function __construct(EmailRepository $emailRepository) { $this->repository = $emailRepository; $this->middleware('event.user:event_admin|event_submitter|event_reviewer|event_co_chair'); } public function sendEmail(Request $request) { try { $role = $request->get('role'); if ($role != 'event_admin') { return response([ 'status' => false, 'message' => 'Access denied' ]); } $event = $request->get('event'); return $this->repository->sendEmail($request, $event); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } /** * @OA\Get( * path="/api/email/list", * summary="Get the list of emails in an event", * tags={"Email"}, * @OA\Parameter(name="role", * in="header", * required=true, * @OA\Schema(type="string") * ), * @OA\Parameter(name="slug-name", * in="header", * required=true, * @OA\Schema(type="string") * ), * @OA\Parameter(name="status", * in="query", * required=false, * description="This is used to filter out emails list based on status. values : draft,sent,processing,failed", * @OA\Schema(type="string") * ), * @OA\Parameter(name="paging", * in="query", * required=false, * description="No. of records in a page. You can use 'All' to get all result", * @OA\Schema(type="string") * ), * @OA\Parameter(name="page", * in="query", * required=false, * @OA\Schema(type="integer") * ), * @OA\Parameter(name="search", * in="query", * required=false, * description="Search by any keyword", * @OA\Schema(type="string") * ), * @OA\Parameter(name="sort", * in="query", * required=false, * description="Sort the list by columns. eg. {""subject"":""asc""}. Multisort available eg. {""subject"":""asc"",""recipients"":""asc""}. Available column names created_at or send_date,subject,recipients.", * @OA\Schema(type="json") * ), * @OA\Response(response="200", * description="List of emails", * ) * ) */ 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, 'emails' => $paging == 'All' ? ['data' => $data, 'total' => $total] : $data, ]); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } public function deleteEmail(Request $request, $id) { try { $role = $request->get('role'); if ($role != 'event_admin') return response([ 'status' => false, 'message' => "Access denied" ]); $email = Email::find($id); if (!$email) return response([ 'status' => false, 'message' => 'Email not found' ]); $this->repository->delete($email); return response([ 'status' => true, 'message' => 'Email deleted successfully ' ]); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } public function downloadFile(Request $request, $id, $fileId) { try { $role = $request->get('role'); if ($role != 'event_admin') return response([ 'status' => false, 'message' => "Access denied" ]); $file = File::whereId($fileId) ->whereModelId($id) ->whereModel(Email::class) ->first(); if (!$file) return response([ 'status' => false, 'message' => "File not found" ]); $filePath = $file->filepath . $file->save_name; return Storage::download($filePath, $file->filename); } catch (Exception $exception) { return $this->handleException($exception, __FUNCTION__, __CLASS__); } } }
Edit
Download
Unzip
Chmod
Delete