Skip to content

Commit ea4acbe

Browse files
committed
0151-my-applications-controller
1 parent 1f99650 commit ea4acbe

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
class MyJobApplicationController extends Controller
8+
{
9+
public function index()
10+
{
11+
return view(
12+
'my_job_application.index',
13+
[
14+
'applications' => auth()->user()->jobApplications()
15+
->with('job', 'job.employer')
16+
->latest()->get()
17+
]
18+
);
19+
}
20+
21+
public function destroy(string $id)
22+
{
23+
//
24+
}
25+
}

job-board/resources/views/components/layout.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class="from-10% via-30% to-90% mx-auto mt-10 max-w-2xl bg-gradient-to-r from-ind
2121
<ul class="flex space-x-2">
2222
@auth
2323
<li>
24-
{{ auth()->user()->name ?? 'Anynomus' }}
24+
<a href="{{ route('my-job-applications.index') }}">
25+
{{ auth()->user()->name ?? 'Anynomus' }}: Applications
26+
</a>
2527
</li>
2628
<li>
2729
<form action="{{ route('auth.destroy') }}" method="POST">
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<x-layout>
2+
<x-breadcrumbs class="mb-4"
3+
:links="['My Job Applications' => '#']" />
4+
5+
@forelse ($applications as $application)
6+
<x-job-card :job="$application->job"></x-job-card>
7+
@empty
8+
@endforelse
9+
</x-layout>

job-board/routes/web.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use App\Http\Controllers\AuthController;
44
use App\Http\Controllers\JobApplicationController;
55
use App\Http\Controllers\JobController;
6+
use App\Http\Controllers\MyJobApplicationController;
67
use Illuminate\Support\Facades\Route;
78

89
/*
@@ -31,4 +32,7 @@
3132
Route::middleware('auth')->group(function () {
3233
Route::resource('job.application', JobApplicationController::class)
3334
->only(['create', 'store']);
35+
36+
Route::resource('my-job-applications', MyJobApplicationController::class)
37+
->only(['index', 'destroy']);
3438
});

0 commit comments

Comments
 (0)