move into sonardesk
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Careers\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
use Modules\Careers\Models\Application;
|
||||
use Modules\Careers\Models\Job;
|
||||
|
||||
final class CareerController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
return view('careers::admin.index', ['jobs' => Job::withCount('applications')->latest()->paginate(20), 'applications' => Application::latest()->limit(10)->get()]);
|
||||
}
|
||||
|
||||
public function store(Request $r): RedirectResponse
|
||||
{
|
||||
Job::create($r->validate(['title' => ['required', 'string', 'max:255'], 'slug' => ['required', 'string', 'max:255', 'unique:career_jobs,slug'], 'department' => ['nullable', 'string', 'max:120'], 'location' => ['nullable', 'string', 'max:120'], 'employment_type' => ['required', 'in:full-time,part-time,contract,temporary,internship'], 'description' => ['nullable', 'string'], 'status' => ['required', 'in:draft,published,closed'], 'published_at' => ['nullable', 'date'], 'closes_at' => ['nullable', 'date', 'after:published_at']]));
|
||||
|
||||
return back()->with('status', 'Job created.');
|
||||
}
|
||||
|
||||
public function destroy(Job $job): RedirectResponse
|
||||
{
|
||||
$job->delete();
|
||||
|
||||
return back()->with('status', 'Job deleted.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user