Started to implement create view (Down to pg 10)

This commit is contained in:
Xander 2025-03-25 12:48:08 +00:00
parent ab7fc65d42
commit e7284fbeb0
4 changed files with 43 additions and 1 deletions

Binary file not shown.

1
app/Models/Job.php Normal file
View file

@ -0,0 +1 @@

View file

@ -4,7 +4,8 @@ Create Job
</x-slot:heading>
<p>
<form>
<form method="POST" action="/jobs">
@csrf
<div class="space-y-12">
<div class="border-b border-gray-900/10 pb-12">
<h2 class="text-base/7 font-semibold text-gray-900">Profile</h2>
@ -30,6 +31,15 @@ Create Job
</div>
</div>
<div class="sm:col-span-4">
<label for="salary" class="block text-sm/6 font-medium text-gray-900">Title</label>
<div class="mt-2">
<div class="flex items-center rounded-md bg-white pl-3 outline-1 -outline-offset-1 outline-gray-300 focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-indigo-600">
<div class="shrink-0 text-base text-gray-500 select-none sm:text-sm/6">workcation.com/</div>
<input type="text" name="salary" id="salary" class="block min-w-0 grow py-1.5 pr-3 pl-1 text-base text-gray-900 placeholder:text-gray-400 focus:outline-none sm:text-sm/6" placeholder="$50000">
</div>
</div>
<div class="col-span-full">

View file

@ -29,6 +29,37 @@ Route::get('/jobs/{id}', function ($id) {
Route::get('/jobs/ceate', function () {
return view('jobs/create');
});
Route::post('/jobs', function () {
    Job::create([
        'title'=>request('title'),
        'salary'=>request('salary'),
        'employer_id'=>1
    ]);
    return redirect('/jobs');
});