feat: year wise proof sorting
This commit is contained in:
@@ -46,13 +46,22 @@ class FacultyController extends Controller
|
||||
$startDateTime = date('Y-m-d H:i:s', strtotime("{$validated['start_date']} {$validated['start_time']}"));
|
||||
$endDateTime = date('Y-m-d H:i:s', strtotime("{$validated['end_date']} {$validated['end_time']}"));
|
||||
|
||||
// Handle the file upload
|
||||
// Handle the file upload
|
||||
$proofPath = null;
|
||||
if ($request->hasFile('proof')) {
|
||||
$originalName = $request->file('proof')->getClientOriginalName();
|
||||
$username = auth()->user()->name;
|
||||
$fileName = $username . '_' . $originalName;
|
||||
$proofPath = $request->file('proof')->storeAs('proofs', $fileName, 'public');
|
||||
|
||||
// Extract year from start_date
|
||||
$year = date('Y', strtotime($validated['start_date']));
|
||||
|
||||
// Create path structure: year/faculty_name
|
||||
$folderPath = 'proofs/' . $year . '/' . $username;
|
||||
|
||||
// Store file in the specified path
|
||||
$proofPath = $request->file('proof')->storeAs($folderPath, $fileName, 'public');
|
||||
}
|
||||
|
||||
// Save the response to the database
|
||||
|
||||
Reference in New Issue
Block a user