Skip to content

Commit 2fca7e4

Browse files
committed
0153-canceling-applications-and-empty-state
1 parent 5c46155 commit 2fca7e4

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

job-board/app/Http/Controllers/MyJobApplicationController.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Controllers;
44

5+
use App\Models\JobApplication;
56
use Illuminate\Http\Request;
67

78
class MyJobApplicationController extends Controller
@@ -22,8 +23,13 @@ public function index()
2223
);
2324
}
2425

25-
public function destroy(string $id)
26+
public function destroy(JobApplication $myJobApplication)
2627
{
27-
//
28+
$myJobApplication->delete();
29+
30+
return redirect()->back()->with(
31+
'success',
32+
'Job application removed.'
33+
);
2834
}
2935
}

job-board/resources/views/my_job_application/index.blade.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,24 @@
2121
${{ number_format($application->job->job_applications_avg_expected_salary) }}
2222
</div>
2323
</div>
24-
<div>Right</div>
24+
<div>
25+
<form action="{{ route('my-job-applications.destroy', $application) }}" method="POST">
26+
@csrf
27+
@method('DELETE')
28+
<x-button>Cancel</x-button>
29+
</form>
30+
</div>
2531
</div>
2632
</x-job-card>
2733
@empty
34+
<div class="rounded-md border border-dashed border-slate-300 p-8">
35+
<div class="text-center font-medium">
36+
No job application yet
37+
</div>
38+
<div class="text-center">
39+
Go find some jobs <a class="text-indigo-500 hover:underline"
40+
href="{{ route('jobs.index') }}">here!</a>
41+
</div>
42+
</div>
2843
@endforelse
2944
</x-layout>

0 commit comments

Comments
 (0)