Enhance internship application process: update InternshipsPageController to retrieve internships and validate application submissions, modify Internship model to include relationships, and implement dynamic application modals in views for internships and careers. Update Livewire configuration for improved file upload handling.

This commit is contained in:
2025-07-29 12:37:25 +05:00
parent 9603402fee
commit f6ddf1d9c1
18 changed files with 986 additions and 119 deletions

View File

@@ -4,17 +4,44 @@ namespace App\Http\Controllers;
use App\Models\Internship;
use Illuminate\Http\Request;
use App\Models\InternshipApplication; // Changed from App\Models\Application
class InternshipsPageController extends Controller
{
public function index()
{
return view('web.pages.internships.index');
$internships = Internship::query()->get();
return view('web.pages.internships.index', compact('internships'));
}
public function store(Request $request)
{
dd($request->all());
$validatedData = $request->validate([
'internship_id' => 'required|exists:internships,id',
'name' => 'required|string|max:255',
'birthdate' => 'required|date',
'resume_file' => 'required|file|mimes:pdf,doc,docx|max:2048',
'email' => 'required|email|max:255',
'phone_number' => 'required|string',
'cover_letter' => 'nullable|string',
]);
$resumePath = $request->file('resume_file')->store('resumes');
InternshipApplication::create([ // Changed to InternshipApplication::create
'internship_id' => $validatedData['internship_id'],
'name' => $validatedData['name'],
'birthdate' => $validatedData['birthdate'],
'resume_file' => $resumePath,
'email' => $validatedData['email'],
'phone_number' => $validatedData['phone_number'],
'cover_letter' => $validatedData['cover_letter'] ?? null,
]);
return response()->json([
'message' => 'Your application has been submitted successfully!',
]);
}
public function show(Internship $internship)