New-OMIS/Modules/Admin/app/Http/Controllers/ResignationController.php

84 lines
2.1 KiB
PHP
Raw Normal View History

2024-04-14 12:44:29 +00:00
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Repositories\ResignationRepository;
class ResignationController extends Controller
{
private $resignationRepository;
public function __construct(ResignationRepository $resignationRepository)
{
$this->resignationRepository = $resignationRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Resignation List';
$data['resignationLists'] = $this->resignationRepository->findAll();
return view('admin::resignations.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Resignation';
$data['editable'] = false;
return view('admin::resignations.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->resignationRepository->create($request->all());
return redirect()->route('resignation.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::resignations.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Resignation';
$data['editable'] = true;
$data['resignation'] = $this->resignationRepository->getResignationById($id);
return view('admin::resignations.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->resignationRepository->update($id, $request->all());
return redirect()->route('resignation.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}