fix enrollment logic, add financial aid, fix class distribution
Tests / PHPUnit (push) Failing after 1m6s
Tests / PHPUnit (push) Failing after 1m6s
This commit is contained in:
@@ -92,6 +92,10 @@ class MessagesController extends BaseController
|
||||
$userRoleModel = new UserRoleModel();
|
||||
//$role = session()->get('role');
|
||||
$userId = session()->get('user_id');
|
||||
if (empty($userId)) {
|
||||
return redirect()->to('/login');
|
||||
}
|
||||
|
||||
// Fetch the user role from the user_roles and roles tables
|
||||
$role = $userRoleModel->select('roles.name')
|
||||
->join('roles', 'roles.id = user_roles.role_id')
|
||||
@@ -103,6 +107,11 @@ class MessagesController extends BaseController
|
||||
$attachmentPath = null;
|
||||
$file = $this->request->getFile('attachment');
|
||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||
$allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'webp', 'doc', 'docx'];
|
||||
$ext = strtolower((string) $file->getExtension());
|
||||
if (! in_array($ext, $allowedExt, true) || $file->getSize() > 5 * 1024 * 1024) {
|
||||
return redirect()->back()->with('error', 'Attachment must be a document or image under 5MB.');
|
||||
}
|
||||
$attachmentPath = $file->store();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user