first commit

This commit is contained in:
Sampanna Rimal 2024-08-27 17:48:06 +05:45
commit 53c0140f58
10839 changed files with 1125847 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

58
.env Normal file
View File

@ -0,0 +1,58 @@
APP_NAME=OMIS
APP_ENV=local
APP_KEY=base64:VoHTBVxg0gnGqmljdwxqtxkcqVUq+9nYYYtHGX4APKU=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=omis_db
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

58
.env.example Normal file
View File

@ -0,0 +1,58 @@
APP_NAME=OMIS
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=omis_db
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

18
.htaccess Normal file
View File

@ -0,0 +1,18 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
</IfModule>

View File

@ -0,0 +1,66 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class AdminController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('admin::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('admin::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,94 @@
<?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\AppreciationRepository;
use Modules\Employee\Repositories\EmployeeRepository;
class AppreciationController extends Controller
{
private $appreciationRepository;
private $employeeRepository;
public function __construct(AppreciationRepository $appreciationRepository, EmployeeRepository $employeeRepository)
{
$this->appreciationRepository = $appreciationRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = "Appreciation Lists";
$data['appreciationLists'] = $this->appreciationRepository->findAll();
return view('admin::appreciations.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = "Create Appreciation";
$data['editable'] = false;
$data['employeeLists'] = $this->employeeRepository->pluck();
return view('admin::appreciations.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->appreciationRepository->create($request->all());
toastr()->success('Appreciation Created Successfully.');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('appreciation.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::appreciations.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = "Edit Appreciation";
$data['editable'] = true;
$data['employeeLists'] = $this->employeeRepository->pluck();
$data['appreciation'] = $this->appreciationRepository->getAppreciationById($id);
return view('admin::appreciations.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->appreciationRepository->update($id, $request->all());
toastr()->success('Appreciation Updated Successfully.');
return redirect()->route('appreciation.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,110 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Modules\Admin\Models\Event;
use Modules\Admin\Models\Holiday;
use Modules\Admin\Repositories\EventRepository;
use Modules\Meeting\Models\Meeting;
class CalendarController extends Controller
{
private $eventRepository;
public function __construct(EventRepository $eventRepository)
{
$this->eventRepository = $eventRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Calendar';
$filters['start_date'] = now()->toDateString();
$data['events'] = $this->eventRepository->findAll($filters);
return view('admin::calendars.index', $data);
}
public function calendarByAjax(Request $request)
{
$filters['start_date'] = $request->start;
$filters['end_date'] = $request->end;
$events = Event::when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("start_date", ">=", $filters["start_date"]);
}
if (isset($filters["end_date"])) {
$query->whereDate("end_date", "<=", $filters["end_date"]);
}
})->get();
$list = [];
foreach ($events as $event) {
$list[] = [
"id" => $event->event_id,
"title" => $event->title,
"type" => 'event',
"start" => $event->start_date,
"end" => $event->end_date,
"className" => "bg-info-subtle",
"desc" => $event->description,
"location" => $event->location,
];
}
$meetings = Meeting::when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("date", ">=", $filters["start_date"]);
}
if (isset($filters["end_date"])) {
$query->whereDate("date", "<=", $filters["end_date"]);
}
})->get();
foreach ($meetings as $meeting) {
$list[] = [
"id" => $meeting->meeting_id,
"title" => $meeting->title,
"type" => 'meeting',
"start" => $meeting->date,
"className" => "bg-warning-subtle",
"location" => $meeting->location,
"desc" => $event->description,
];
}
$holidays = Holiday::when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("start_date", ">=", $filters["start_date"]);
}
if (isset($filters["end_date"])) {
$query->whereDate("end_date", "<=", $filters["end_date"]);
}
})->get();
foreach ($holidays as $holiday) {
$list[] = [
"id" => $holiday->holiday_id,
"title" => $holiday->title,
"type" => 'holiday',
"start" => $holiday->start_date,
"end" => $holiday->end_date,
"className" => "bg-danger",
"overlap" => false,
"display" => 'background',
"color" => '#ff9f89',
"desc" => $event->description,
];
}
return $list;
}
}

View File

@ -0,0 +1,83 @@
<?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\CasteRepository;
class CasteController extends Controller
{
private $casteRepository;
public function __construct(CasteRepository $casteRepository)
{
$this->casteRepository = $casteRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Caste List';
$data['casteLists'] = $this->casteRepository->findAll();
return view('admin::castes.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Caste';
$data['editable'] = false;
return view('admin::castes.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->casteRepository->create($request->all());
return redirect()->route('caste.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::castes.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Caste';
$data['editable'] = true;
$data['caste'] = $this->casteRepository->getCasteById($id);
return view('admin::castes.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->casteRepository->update($id, $request->all());
return redirect()->route('caste.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,83 @@
<?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\CityRepository;
class CityController extends Controller
{
private $cityRepository;
public function __construct(CityRepository $cityRepository)
{
$this->cityRepository = $cityRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'City List';
$data['cityLists'] = $this->cityRepository->findAll();
return view('admin::cities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create City';
$data['editable'] = false;
return view('admin::cities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->cityRepository->create($request->all());
return redirect()->route('city.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::cities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit City';
$data['editable'] = true;
$data['city'] = $this->cityRepository->getCityById($id);
return view('admin::cities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->cityRepository->update($id, $request->all());
return redirect()->route('city.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,115 @@
<?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\CompanyRepository;
use Modules\Admin\Services\AdminService;
class CompanyController extends Controller
{
private $companyRepository;
private $adminService;
public function __construct(CompanyRepository $companyRepository, AdminService $adminService)
{
$this->companyRepository = $companyRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Company Lists';
$data['companyLists'] = $this->companyRepository->findAll();
return view('admin::companies.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Company';
$data['editable'] = false;
$data['companyTypeLists'] = $this->adminService->pluckCompanyTypes();
return view('admin::companies.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->companyRepository->create($request->all());
toastr()->success('Company created successfully!');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('company.index')->with('Company created successfully!');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::companies.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit Company';
$data['editable'] = true;
$data['companyTypeLists'] = $this->adminService->pluckCompanyTypes();
$data['company'] = $this->companyRepository->getCompanyById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::companies.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->companyRepository->update($id, $request->except(['_method','_token']));
toastr()->success('Company Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('company.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->companyRepository->delete($id);
toastr()->success('Company Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('company.index');
}
}

View File

@ -0,0 +1,109 @@
<?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\CompanyTypeRepository;
class CompanyTypeController extends Controller
{
private $companyTypeRepository;
public function __construct(CompanyTypeRepository $companyTypeRepository)
{
$this->companyTypeRepository = $companyTypeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Company Type Lists';
$data['companyTypeLists'] = $this->companyTypeRepository->findAll();
return view('admin::companytypes.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Company Type';
$data['editable'] = false;
return view('admin::companytypes.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->companyTypeRepository->create($request->all());
toastr()->success('Company Type Created Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('companyType.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::companytypes.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit Company Type';
$data['editable'] = true;
$data['companyType'] = $this->companyTypeRepository->getCompanyTypeById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::companytypes.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->companyTypeRepository->update($id, $request->except(['_token', '_method']));
toastr()->success('Company Type Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('companyType.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->companyTypeRepository->delete($id);
toastr()->success('Company Type Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('companyType.index');
}
}

View File

@ -0,0 +1,109 @@
<?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\ComplaintRepository;
class ComplaintController extends Controller
{
private $complaintRepository;
public function __construct(ComplaintRepository $complaintRepository)
{
$this->complaintRepository = $complaintRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Complaint Lists';
$data['complaintLists'] = $this->complaintRepository->findAll();
return view('admin::complaints.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Complaint';
$data['editable'] = false;
return view('admin::complaints.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->complaintRepository->create($request->all());
toastr()->success('Complaint Created Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('complaint.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::complaints.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit Complaint';
$data['editable'] = true;
$data['complaint'] = $this->complaintRepository->getComplaintById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::complaints.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->complaintRepository->update($id, $request->all());
toastr()->success('Complaint Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('complaint.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->complaintRepository->delete($id);
toastr()->success('Complaint Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('complaint.index');
}
}

View File

@ -0,0 +1,83 @@
<?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\CountryRepository;
class CountryController extends Controller
{
private $countryRepository;
public function __construct(CountryRepository $countryRepository)
{
$this->countryRepository = $countryRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Country List';
$data['countryLists'] = $this->countryRepository->findAll();
return view('admin::countries.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Country';
$data['editable'] = false;
return view('admin::countries.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->countryRepository->create($request->all());
return redirect()->route('country.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::countries.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Country';
$data['editable'] = true;
$data['country'] = $this->countryRepository->getCountryById($id);
return view('admin::countries.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->countryRepository->update($id, $request->all());
return redirect()->route('country.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,104 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DepartmentRepository;
use Modules\Employee\Repositories\EmployeeRepository;
class DepartmentController extends Controller
{
private $departmentRepository;
private $employeeRepository;
public function __construct(DepartmentRepository $departmentRepository, EmployeeRepository $employeeRepository)
{
$this->departmentRepository = $departmentRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
// toastr()
// ->info('Welcome back')
// ->success('Data has been saved successfully!')
// ->warning('Are you sure you want to proceed ?');
$data['title'] = 'Department List';
$data['departmentLists'] = $this->departmentRepository->findAll();
return view('admin::departments.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
// toastr('Department has been created!', 'success');
$data['title'] = 'Create Department';
$data['editable'] = false;
$data['employeeLists'] = $this->employeeRepository->pluck();
return view('admin::departments.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
// try {
$this->departmentRepository->create($request->all());
// toastr()->success('Department has been created!');
// } catch (\Throwable $th) {
// toastr()->error($th->getMessage());
// }
// toastr('Department has been created!', 'success');
// return back();
return redirect()->route('department.index')->with('sucess', 'adw');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::departments.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Department';
$data['editable'] = true;
$data['employeeLists'] = $this->employeeRepository->pluck();
$data['department'] = $this->departmentRepository->getDepartmentById($id);
return view('admin::departments.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->departmentRepository->update($id, $request->except(['_token', '_method']));
toastr()->success('Department has been updated!');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('department.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,83 @@
<?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\DesignationRepository;
class DesignationController extends Controller
{
private $designationRepository;
public function __construct(DesignationRepository $designationRepository)
{
$this->designationRepository = $designationRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Designation List';
$data['designationLists'] = $this->designationRepository->findAll();
return view('admin::designations.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Designation';
$data['editable'] = false;
return view('admin::designations.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->designationRepository->create($request->all());
return redirect()->route('designation.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::designations.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Designation';
$data['editable'] = true;
$data['designation'] = $this->designationRepository->getDesignationById($id);
return view('admin::designations.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->designationRepository->update($id, $request->all());
return redirect()->route('designation.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,108 @@
<?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\DistrictRepository;
use Modules\Admin\Services\AdminService;
class DistrictController extends Controller
{
private $districtRepository;
private $adminService;
public function __construct(DistrictRepository $districtRepository, AdminService $adminService)
{
$this->districtRepository = $districtRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'District List';
$data['districtLists'] = $this->districtRepository->findAll();
return view('admin::districts.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create District';
$data['editable'] = false;
$data['provinceLists'] = $this->adminService->pluckProvinces();
return view('admin::districts.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->districtRepository->create($request->all());
toastr()->success('District created successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('district.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::districts.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit District';
$data['editable'] = true;
$data['district'] = $this->districtRepository->getDistrictById($id);
$data['provinceLists'] = $this->adminService->pluckProvinces();
return view('admin::districts.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->districtRepository->update($id, $request->all());
toastr()->success('District updated successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('district.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->districtRepository->delete($id);
toastr()->success('District deleted successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('district.index');
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\FieldInterface;
class DropdownController extends Controller
{
private $fieldRepository;
private $dropdownRepository;
public function __construct(FieldInterface $fieldRepository,
DropdownInterface $dropdownRepository) {
$this->fieldRepository = $fieldRepository;
$this->dropdownRepository = $dropdownRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Dropdown List';
$data['fields'] = $this->fieldRepository->findAll();
$data['fieldLists'] = $data['fields']->pluck('title', 'id');
return view('admin::dropdown.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
// $inputData['status'] = $request->status ?? 10;
$this->dropdownRepository->create($inputData);
toastr()->success('Dropdown Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$dropdownModel = $this->dropdownRepository->getDropdownById($id);
$fieldLists = $this->fieldRepository->getList();
return response()->json([
'view' => view('admin::dropdown.edit', compact('dropdownModel', 'fieldLists'))->render(),
'status' => true,
]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
try {
$inputData['status'] = $request->status ?? 10;
$this->dropdownRepository->update($id, $inputData);
toastr()->success('Dropdown Update Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->dropdownRepository->delete($id);
toastr()->success('Dropdown Deleted Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return response()->json([
'status' => true,
]);
}
}

View File

@ -0,0 +1,83 @@
<?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\EthnicityRepository;
class EthnicityController extends Controller
{
private $ethnicityRepository;
public function __construct(EthnicityRepository $ethnicityRepository)
{
$this->ethnicityRepository = $ethnicityRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Ethnicity List';
$data['ethnicityLists'] = $this->ethnicityRepository->findAll();
return view('admin::ethnicities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Ethnicity';
$data['editable'] = false;
return view('admin::ethnicities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->ethnicityRepository->create($request->all());
return redirect()->route('ethnicity.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::ethnicities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Ethnicity';
$data['editable'] = true;
$data['ethnicity'] = $this->ethnicityRepository->getEthnicityById($id);
return view('admin::ethnicities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->ethnicityRepository->update($id, $request->all());
return redirect()->route('ethnicity.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\EventRepository;
class EventController extends Controller
{
private $eventRepository;
public function __construct(EventRepository $eventRepository)
{
$this->eventRepository = $eventRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Event Lists';
$data['eventLists'] = $this->eventRepository->findAll();
return view('admin::events.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Event';
$data['editable'] = false;
return view('admin::events.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
// try {
$this->eventRepository->create($request->all());
toastr()->success('Event Created Successfully');
// } catch (\Throwable $th) {
// toastr()->error($th->getMessage());
// }
return redirect()->route('event.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::events.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit Event';
$data['editable'] = true;
$data['event'] = $this->eventRepository->getEventById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::events.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->eventRepository->update($id, $request->except(['_method', '_token']));
toastr()->success('Event Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('event.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->eventRepository->delete($id);
toastr()->success('Event Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('event.index');
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\FieldInterface;
class FieldController extends Controller
{
private $fieldRepository;
private $dropdownRepository;
public function __construct(FieldInterface $fieldRepository,
DropdownInterface $dropdownRepository) {
$this->fieldRepository = $fieldRepository;
$this->dropdownRepository = $dropdownRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
return view('admin::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
$this->fieldRepository->create($inputData);
toastr()->success('Field Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('admin::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,83 @@
<?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\GenderRepository;
class GenderController extends Controller
{
private $genderRepository;
public function __construct(GenderRepository $genderRepository)
{
$this->genderRepository = $genderRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Gender List';
$data['genderLists'] = $this->genderRepository->findAll();
return view('admin::genders.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Gender';
$data['editable'] = false;
return view('admin::genders.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->genderRepository->create($request->all());
return redirect()->route('gender.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::genders.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Gender';
$data['editable'] = true;
$data['gender'] = $this->genderRepository->getGenderById($id);
return view('admin::genders.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->genderRepository->update($id, $request->all());
return redirect()->route('gender.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,109 @@
<?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\HolidayRepository;
class HolidayController extends Controller
{
private $holidayRepository;
public function __construct(HolidayRepository $holidayRepository)
{
$this->holidayRepository = $holidayRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Holiday Lists';
$data['holidayLists'] = $this->holidayRepository->findAll();
return view('admin::holidays.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Holiday';
$data['editable'] = false;
return view('admin::holidays.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->holidayRepository->create($request->all());
toastr()->success('Holiday Created Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('holiday.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::holidays.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit Holiday';
$data['editable'] = true;
$data['holiday'] = $this->holidayRepository->getHolidayById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::holidays.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->holidayRepository->update($id, $request->all());
toastr()->success('Holiday Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('holiday.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->holidayRepository->delete($id);
toastr()->success('Holiday Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('holiday.index');
}
}

View File

@ -0,0 +1,108 @@
<?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\MunicipalityRepository;
use Modules\Admin\Services\AdminService;
class MunicipalityController extends Controller
{
private $municipalityRepository;
private $adminService;
public function __construct(MunicipalityRepository $municipalityRepository, AdminService $adminService)
{
$this->municipalityRepository = $municipalityRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Municipality List';
$data['municipalityLists'] = $this->municipalityRepository->findAll();
return view('admin::municipalities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Municipality';
$data['editable'] = false;
$data['districtLists'] = $this->adminService->pluckDistricts();
return view('admin::municipalities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->municipalityRepository->create($request->all());
toastr()->success('Municipality created successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('municipality.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::municipalities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Municipality';
$data['editable'] = true;
$data['municipality'] = $this->municipalityRepository->getMunicipalityById($id);
$data['districtLists'] = $this->adminService->pluckDistricts();
return view('admin::municipalities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->municipalityRepository->update($id, $request->all());
toastr()->success('Municipality updated successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('municipality.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->municipalityRepository->delete($id);
toastr()->success('Municipality deleted successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('municipality.index');
}
}

View File

@ -0,0 +1,83 @@
<?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\NationalityRepository;
class NationalityController extends Controller
{
private $nationalityRepository;
public function __construct(NationalityRepository $nationalityRepository)
{
$this->nationalityRepository = $nationalityRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Nationality List';
$data['nationalityLists'] = $this->nationalityRepository->findAll();
return view('admin::nationalities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Nationality';
$data['editable'] = false;
return view('admin::nationalities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->nationalityRepository->create($request->all());
return redirect()->route('nationality.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::nationalities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Nationality';
$data['editable'] = true;
$data['nationality'] = $this->nationalityRepository->getNationalityById($id);
return view('admin::nationalities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->nationalityRepository->update($id, $request->all());
return redirect()->route('nationality.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$data['notifications'] = auth()->user()->notifications;
return view('notification.index', $data);
}
public function markAsRead(Request $request)
{
$filterData = $request->all();
try {
$notification = auth()->user()->notifications()->where('id', $filterData['id'])->first();
if ($notification) {
$notification->markAsRead();
}
return redirect()->back()->withSuccess('Mark As Read');
} catch (\Throwable $th) {
return redirect()->back()->withError('Something Went Wrong!');
}
}
public function markAllAsRead(Request $request)
{
try {
foreach (auth()->user()->unreadNotifications as $notification) {
$notification->markAsRead();
}
return redirect()->back()->withSuccess('Mark All As Read');
} catch (\Throwable $th) {
//throw $th;
return redirect()->back()->withError('Something Went Wrong!');
}
}
}

View File

@ -0,0 +1,83 @@
<?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\ProgressStatusRepository;
class ProgressStatusController extends Controller
{
private $progressStatusRepository;
public function __construct(ProgressStatusRepository $progressStatusRepository)
{
$this->progressStatusRepository = $progressStatusRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'ProgressStatus List';
$data['progressStatusLists'] = $this->progressStatusRepository->findAll();
return view('admin::progressstatuses.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create ProgressStatus';
$data['editable'] = false;
return view('admin::progressstatuses.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->progressStatusRepository->create($request->all());
return redirect()->route('progressStatus.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::progressstatuses.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit ProgressStatus';
$data['editable'] = true;
$data['progressStatus'] = $this->progressStatusRepository->getProgressStatusById($id);
return view('admin::progressstatuses.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->progressStatusRepository->update($id, $request->all());
return redirect()->route('progressStatus.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,125 @@
<?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\DepartmentInterface;
use Modules\Admin\Repositories\DepartmentRepository;
use Modules\Admin\Repositories\DesignationInterface;
use Modules\Admin\Repositories\DesignationRepository;
use Modules\Admin\Repositories\FieldInterface;
use Modules\Admin\Repositories\FieldRepository;
use Modules\Admin\Repositories\PromotionDemotionInterface;
use Modules\Employee\Repositories\EmployeeInterface;
use Modules\Employee\Repositories\EmployeeRepository;
class PromotionDemotionController extends Controller
{
private $promotionDemotionRepository;
private $designationRepository;
private $departmentRepository;
private $employeeRepository;
private $fieldRepository;
public function __construct(PromotionDemotionInterface $promotionDemotionRepository, DepartmentInterface $departmentRepository, DesignationInterface $designationRepository, EmployeeInterface $employeeRepository, FieldInterface $fieldRepository)
{
$this->promotionDemotionRepository = $promotionDemotionRepository;
$this->designationRepository = $designationRepository;
$this->departmentRepository = $departmentRepository;
$this->employeeRepository = $employeeRepository;
$this->fieldRepository = $fieldRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = "Promotion/ Demotion Lists";
$data['promotionDemotionLists'] = $this->promotionDemotionRepository->findAll();
return view('admin::promotiondemotions.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['editable'] = false;
$data['title'] = "Create Promotion/ Demotion";
$data['employeeList'] = $this->employeeRepository->pluck();
$data['designationList'] = $this->designationRepository->pluck();
$data['departmentList'] = $this->departmentRepository->pluck();
$data['rankingTypeList'] = $this->fieldRepository->getDropdownByAlias('ranking-type');
return view('admin::promotiondemotions.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->promotionDemotionRepository->create($request->all());
toastr()->success('Record has been created!');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('promotionDemotion.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::promotiondemotions.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['editable'] = false;
$data['title'] = "Edit Promotion/ Demotion";
$data['promotionDemotion'] = $this->promotionDemotionRepository->getPromotionDemotionById($id);
$data['designationList'] = $this->designationRepository->pluck();
$data['employeeList'] = $this->employeeRepository->pluck();
$data['departmentList'] = $this->departmentRepository->pluck();
$data['rankingTypeList'] = $this->fieldRepository->getDropdownByAlias('ranking-type');
return view('admin::promotiondemotions.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->promotionDemotionRepository->update($id, $request->all());
toastr()->success('Record has been updated');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('promotionDemotion.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->promotionDemotionRepository->delete($id);
toastr()->success('Record has been deleted!');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('promotionDemotion.index');
}
}

View File

@ -0,0 +1,108 @@
<?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\ProvinceRepository;
use Modules\Admin\Services\AdminService;
class ProvinceController extends Controller
{
private $provinceRepository;
private $adminService;
public function __construct(ProvinceRepository $provinceRepository, AdminService $adminService)
{
$this->provinceRepository = $provinceRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Province List';
$data['provinceLists'] = $this->provinceRepository->findAll();
return view('admin::provinces.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Province';
$data['editable'] = false;
$data['countryLists'] = $this->adminService->pluckCountries();
return view('admin::provinces.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->provinceRepository->create($request->all());
toastr()->success('Province created successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('province.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::provinces.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Province';
$data['editable'] = true;
$data['province'] = $this->provinceRepository->getProvinceById($id);
$data['countryLists'] = $this->adminService->pluckCountries();
return view('admin::provinces.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->provinceRepository->update($id, $request->all());
toastr()->success('Province updated successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('province.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->provinceRepository->delete($id);
toastr()->success('Province deleted successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('province.index');
}
}

View File

@ -0,0 +1,104 @@
<?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;
use Modules\Employee\Repositories\EmployeeRepository;
class ResignationController extends Controller
{
private $resignationRepository;
private $employeeRepository;
public function __construct(ResignationRepository $resignationRepository, EmployeeRepository $employeeRepository)
{
$this->resignationRepository = $resignationRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Resignation Lists';
$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;
$data['employeeLists'] = $this->employeeRepository->pluck();
return view('admin::resignations.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->resignationRepository->create($request->all());
toastr()->success('Resignation has been created!');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
// 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['employeeLists'] = $this->employeeRepository->pluck();
$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
{
try {
$this->resignationRepository->update($id, $request->except(['_method', '_token']));
toastr()->success('Resignation has been updated!');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('resignation.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->resignationRepository->delete($id);
toastr()->success('Resignation has been deleted');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return to_route('resignation.index');
}
}

View File

@ -0,0 +1,119 @@
<?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\TransferRepository;
use Modules\Admin\Services\AdminService;
use Modules\Employee\Repositories\EmployeeRepository;
class TransferController extends Controller
{
private $transferRepository;
private $employeeRepository;
private $adminService;
public function __construct(TransferRepository $transferRepository, EmployeeRepository $employeeRepository, AdminService $adminService)
{
$this->transferRepository = $transferRepository;
$this->employeeRepository = $employeeRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Transfer Lists';
$data['transferLists'] = $this->transferRepository->findAll();
return view('admin::transfers.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Transfer';
$data['editable'] = false;
$data['employeeLists'] = $this->employeeRepository->pluck();
$data['departmentLists'] = $this->adminService->pluckDepartments();
return view('admin::transfers.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->transferRepository->create($request->all());
toastr()->success('Transfer Created Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('transfer.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::transfers.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit Transfer';
$data['editable'] = true;
$data['employeeLists'] = $this->employeeRepository->pluck();
$data['departmentLists'] = $this->adminService->pluckDepartments();
$data['transfer'] = $this->transferRepository->getTransferById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::transfers.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->transferRepository->update($id, $request->except(['_method','_token']));
toastr()->success('Transfer Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('transfer.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->transferRepository->delete($id);
toastr()->success('Transfer Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('transfer.index');
}
}

View File

@ -0,0 +1,114 @@
<?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\WarningRepository;
use Modules\Employee\Repositories\EmployeeRepository;
class WarningController extends Controller
{
private $warningRepository;
private $employeeRepository;
public function __construct(WarningRepository $warningRepository, EmployeeRepository $employeeRepository)
{
$this->warningRepository = $warningRepository;
$this->employeeRepository = $employeeRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Warning Lists';
$data['warningLists'] = $this->warningRepository->findAll();
return view('admin::warnings.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Warning';
$data['editable'] = false;
$data['employeeLists'] = $this->employeeRepository->pluck();
return view('admin::warnings.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->warningRepository->create($request->all());
toastr()->success('Warning Created Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('warning.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::warnings.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit Warning';
$data['editable'] = true;
$data['employeeLists'] = $this->employeeRepository->pluck();
$data['warning'] = $this->warningRepository->getWarningById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::warnings.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->warningRepository->update($id, $request->except(['_method', '_token']));
toastr()->success('Warning Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('warning.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->warningRepository->delete($id);
toastr()->success('Warning Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('warning.index');
}
}

View File

@ -0,0 +1,109 @@
<?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\WorkShiftRepository;
class WorkShiftController extends Controller
{
private $workShiftRepository;
public function __construct(WorkShiftRepository $workShiftRepository)
{
$this->workShiftRepository = $workShiftRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'WorkShift Lists';
$data['workShiftLists'] = $this->workShiftRepository->findAll();
return view('admin::workshifts.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create WorkShift';
$data['editable'] = false;
return view('admin::workshifts.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->workShiftRepository->create($request->all());
toastr()->success('WorkShift Created Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('workShift.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::workshifts.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
try {
$data['title'] = 'Edit WorkShift';
$data['editable'] = true;
$data['workShift'] = $this->workShiftRepository->getWorkShiftById($id);
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return view('admin::workshifts.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->workShiftRepository->update($id, $request->all());
toastr()->success('WorkShift Updated Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('workShift.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->workShiftRepository->delete($id);
toastr()->success('WorkShift Deleted Successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('workShift.index');
}
}

View File

View File

View File

@ -0,0 +1,55 @@
<?php
namespace Modules\Admin\Models;
use App\Observers\AppreciationObserver;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Notifications\Notifiable;
use Modules\Admin\Database\factories\AppreciationFactory;
use Modules\Employee\Models\Employee;
#[ObservedBy([AppreciationObserver::class])]
class Appreciation extends Model
{
use HasFactory, StatusTrait, Notifiable;
protected $table = 'tbl_appreciations';
protected $primaryKey = 'appreciation_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'alias',
'type',
'employee_id',
'appreciated_by',
'appreciated_date',
'status',
'description',
'remarks',
];
public $appends = ['status_name'];
public const APPRECIATION_TYPE = [
1 => 'Employee of the Month',
2 => 'Best Manager',
3 => 'Dedicated Employeer',
4 => 'Hard Working Employee',
];
public function appreciatee()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function appreciator()
{
return $this->belongsTo(Employee::class, 'appreciated_by')->withDefault();
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CasteFactory;
class Caste extends Model
{
use HasFactory;
protected $table = "tbl_castes";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@ -0,0 +1,27 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CityFactory;
class City extends Model
{
use HasFactory;
protected $table = "tbl_cities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'district_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CompanyFactory;
class Company extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_companies';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'alias',
'company_type_id',
'address',
'bank_name',
'bank_acc_no',
'bank_acc_branch',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $appends = ['status_name'];
protected function companyType()
{
return $this->belongsTo(CompanyType::class, 'company_type_id')->withDefault();
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CompanyTypeFactory;
class CompanyType extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_company_types';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'alias',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $appends = ['status_name'];
}

View File

@ -0,0 +1,45 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Notifications\Notifiable;
use Modules\Admin\Database\factories\ComplaintFactory;
use Modules\Employee\Models\Employee;
class Complaint extends Model
{
use HasFactory, Notifiable, StatusTrait;
protected $table = 'tbl_complaints';
protected $primaryKey = 'complaint_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'complaint_id',
'employee_id',
'complaint_date',
'complaint_by',
'description',
'remarks',
'status',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public function respondent()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function complainant()
{
return $this->belongsTo(Employee::class, 'complaint_by')->withDefault();
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\CountryFactory;
class Country extends Model
{
use HasFactory, StatusTrait;
protected $table = "tbl_countries";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $appends = ['status_name'];
}

View File

@ -0,0 +1,33 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Modules\Employee\Models\Employee;
class Department extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_departments';
protected $primaryKey = 'department_id';
protected $fillable = [
'name',
'department_head',
'status',
'description',
'remarks',
'createdBy',
'updatedBy'
];
protected $appends = ['status_name'];
public function departmentHead()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Designation extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_designations';
protected $primaryKey = 'designation_id';
protected $fillable = [
'name',
'department_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy'
];
protected $appends = ['status_name'];
public function department()
{
return $this->belongsTo(Department::class, 'department_id')->withDefault();
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\DistrictFactory;
class District extends Model
{
use HasFactory;
protected $table = "tbl_districts";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'province_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function province(){
return $this->belongsTo(Province::class,'province_id');
}
// protected function name(): Attribute
// {
// return Attribute::make(
// get: fn($value) => strtolower($value),
// );
// }
}

View File

@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Str;
class Dropdown extends Model
{
use StatusTrait;
protected $table = 'tbl_dropdowns';
protected $fillable = ['fid', 'title', 'alias', 'status'];
protected $appends = ['status_name'];
protected static function booted()
{
static::creating(function ($field) {
$field->alias = Str::slug($field->title);
});
static::updating(function ($field) {
$field->alias = Str::slug($field->title);
});
}
public function field()
{
return $this->belongsTo(Field::class, 'fid');
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\EthinicityFactory;
class Ethnicity extends Model
{
use HasFactory;
protected $table = "tbl_ethnicities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@ -0,0 +1,57 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\EventFactory;
class Event extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_events';
protected $primaryKey = "event_id";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'type',
'start_date',
'end_date',
'start_time',
'end_time',
'location',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected $casts = [
'start_date' => 'datetime',
'end_date' => 'datetime',
];
public const MEETING_TYPE = [
1 => 'Meeting',
2 => 'Training Sessions',
3 => 'Seminars',
4 => 'Celebrations',
5 => 'Product Launches',
6 => 'Wellness Events',
];
public $appends = ['status_name'];
public function getMeetingType()
{
return self::MEETING_TYPE[$this->type] ?? null;
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Str;
class Field extends Model
{
protected $table = 'tbl_fields';
protected $fillable = ['title', 'alias', 'status'];
protected static function booted()
{
static::creating(function ($field) {
$field->alias = Str::slug($field->title);
});
static::updating(function ($field) {
$field->alias = Str::slug($field->title);
});
}
public function dropdown()
{
return $this->hasMany(Dropdown::class, 'fid');
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\GenderFactory;
class Gender extends Model
{
use HasFactory;
protected $table = "tbl_genders";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@ -0,0 +1,33 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\HolidayFactory;
class Holiday extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_holidays';
protected $primaryKey = "holiday_id";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'title',
'start_date',
'end_date',
'status',
'description',
'remarks',
'createdBy',
'updatedBy'
];
public $appends = ['status_name'];
}

View File

@ -0,0 +1,33 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\MunicipalityFactory;
class Municipality extends Model
{
use HasFactory;
protected $table = "tbl_municipalities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'distict_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function district()
{
return $this->belongsTo(District::class, 'district_id');
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\NationalityFactory;
class Nationality extends Model
{
use HasFactory;
protected $table = "tbl_nationalities";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
}

View File

@ -0,0 +1,22 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\ProgressStatusFactory;
class ProgressStatus extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*/
protected $fillable = [];
protected static function newFactory(): ProgressStatusFactory
{
//return ProgressStatusFactory::new();
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace Modules\Admin\Models;
use App\Observers\PromotionDemotionObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Employee\Models\Employee;
#[ObservedBy([PromotionDemotionObserver::class])]
class PromotionDemotion extends Model
{
use HasFactory;
protected $table = "tbl_promotion_demotions";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'title',
'type',
'old_designation_id',
'new_designation_id',
'status',
'description',
'remarks',
];
public function employee()
{
return $this->belongsTo(Employee::class, 'employee_id');
}
public function oldDesignation()
{
return $this->belongsTo(Designation::class, 'old_designation_id')->withDefault(['name' => '-']);
}
public function newDesignation()
{
return $this->belongsTo(Designation::class, 'new_designation_id')->withDefault(['name' => '-']);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Modules\Admin\Database\factories\ProvinceFactory;
class Province extends Model
{
use HasFactory;
protected $table = "tbl_provinces";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'name',
'country_id',
'status',
'description',
'remarks',
'createdBy',
'updatedBy',
];
protected function country()
{
return $this->belongsTo(Country::class, 'country_id');
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\ResignationFactory;
use Modules\Employee\Models\Employee;
class Resignation extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_resignations';
protected $primaryKey = 'resignation_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'resignation_date',
'resignation_type',
'progress_status_id',
'approved_date',
'approved_by',
'description',
'remarks',
'status',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public const RESIGNATION_TYPE = [
1 =>'Voluntary',
2=> 'Involuntary',
3=> 'Retirement',
];
public const PROGRESS_STATUS = [
1 => 'Pending',
2 => 'Approved',
3 => 'Rejected',
];
public function resigner()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function approver()
{
return $this->belongsTo(Employee::class, 'approved_by')->withDefault();
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Modules\Admin\Models;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Employee\Models\Employee;
class Transfer extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_transfers';
protected $primaryKey = 'transfer_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'old_department_id',
'new_department_id',
'status',
'transfer_date',
'transfer_type',
'progress_status_id',
'approved_by',
'approved_date',
'description',
'remarks',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public const PROGRESS_STATUS = [
1 => 'Pending',
2 => 'Approved',
3 => 'Rejected',
];
public const TRANSFER_TYPE = [
1 => 'Internal',
2 => 'External',
3 => 'Temporary',
];
public function oldDepartment()
{
return $this->belongsTo(Department::class, 'old_department_id')->withDefault();
}
public function newDepartment()
{
return $this->belongsTo(Department::class, 'new_department_id')->withDefault();
}
public function employee()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
public function approver()
{
return $this->belongsTo(Employee::class, 'approved_by')->withDefault();
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace Modules\Admin\Models;
use App\Observers\WarningObserver;
use App\Traits\StatusTrait;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Employee\Models\Employee;
#[ObservedBy([WarningObserver::class])]
class Warning extends Model
{
use HasFactory, StatusTrait;
protected $table = 'tbl_warnings';
protected $primaryKey = 'warning_id';
/**
* The attributes that are mass assignable.
*/
protected $fillable = [
'employee_id',
'type',
'reason',
'warning_date',
'description',
'remarks',
'status',
'createdBy',
'updatedBy',
];
public $appends = ['status_name'];
public const WARNING_TYPE = [
1 => 'Verbal Warning',
2 => 'Written Warning',
3 => 'Suspension',
4 => 'Termination Notice',
];
public const WARNING_REASON = [
1 => 'Performance Issues',
2 => 'Attendance Problems',
3 => 'Policy Violations',
4 => 'Customer Complaints',
5 => 'Interpersonal Issues',
6 => 'Behavioral Concerns',
];
public function warningRecipient()
{
return $this->belongsTo(Employee::class, 'employee_id')->withDefault();
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Modules\Admin\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Modules\Admin\Database\factories\WorkShiftFactory;
class WorkShift extends Model
{
use HasFactory;
protected $table = "tbl_work_shifts";
protected $primaryKey = "work_shift_id";
/**
* The attributes that are mass assignable.
*/
protected $fillable = [];
}

View File

View File

@ -0,0 +1,149 @@
<?php
namespace Modules\Admin\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Modules\Admin\Repositories\CountryInterface;
use Modules\Admin\Repositories\CountryRepository;
use Modules\Admin\Repositories\DepartmentInterface;
use Modules\Admin\Repositories\DepartmentRepository;
use Modules\Admin\Repositories\DesignationInterface;
use Modules\Admin\Repositories\DesignationRepository;
use Modules\Admin\Repositories\DistrictInterface;
use Modules\Admin\Repositories\DistrictRepository;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\DropdownRepository;
use Modules\Admin\Repositories\FieldInterface;
use Modules\Admin\Repositories\FieldRepository;
use Modules\Admin\Repositories\MunicipalityInterface;
use Modules\Admin\Repositories\MunicipalityRepository;
use Modules\Admin\Repositories\PromotionDemotionInterface;
use Modules\Admin\Repositories\PromotionDemotionRepository;
use Modules\Admin\Repositories\ProvinceInterface;
use Modules\Admin\Repositories\ProvinceRepository;
use Modules\Admin\Repositories\ResignationInterface;
use Modules\Admin\Repositories\ResignationRepository;
use Modules\Admin\Repositories\TransferInterface;
use Modules\Admin\Repositories\TransferRepository;
use Modules\Admin\Repositories\WarningInterface;
class AdminServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Admin';
protected string $moduleNameLower = 'admin';
/**
* Boot the application events.
*/
public function boot(): void
{
$this->registerCommands();
$this->registerCommandSchedules();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations'));
}
/**
* Register the service provider.
*/
public function register(): void
{
$this->app->bind(FieldInterface::class, FieldRepository::class);
$this->app->bind(DropdownInterface::class, DropdownRepository::class);
$this->app->bind(DepartmentInterface::class, DepartmentRepository::class);
$this->app->bind(DesignationInterface::class, DesignationRepository::class);
$this->app->bind(CountryInterface::class, CountryRepository::class);
$this->app->bind(ProvinceInterface::class, ProvinceRepository::class);
$this->app->bind(DistrictInterface::class, DistrictRepository::class);
$this->app->bind(MunicipalityInterface::class, MunicipalityRepository::class);
$this->app->bind(PromotionDemotionInterface::class, PromotionDemotionRepository::class);
$this->app->bind(TransferInterface::class, TransferRepository::class);
$this->app->bind(ResignationInterface::class, ResignationRepository::class);
$this->app->bind(WarningInterface::class, WarningInterface::class);
$this->app->register(RouteServiceProvider::class);
}
/**
* Register commands in the format of Command::class
*/
protected function registerCommands(): void
{
// $this->commands([]);
}
/**
* Register command Schedules.
*/
protected function registerCommandSchedules(): void
{
// $this->app->booted(function () {
// $schedule = $this->app->make(Schedule::class);
// $schedule->command('inspire')->hourly();
// });
}
/**
* Register translations.
*/
public function registerTranslations(): void
{
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
$this->loadJsonTranslationsFrom($langPath);
} else {
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
}
}
/**
* Register config.
*/
protected function registerConfig(): void
{
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower . '.php')], 'config');
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
}
/**
* Register views.
*/
public function registerViews(): void
{
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
$sourcePath = module_path($this->moduleName, 'resources/views');
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower . '-module-views']);
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
$componentNamespace = str_replace('/', '\\', config('modules.namespace') . '\\' . $this->moduleName . '\\' . ltrim(config('modules.paths.generator.component-class.path'), config('modules.paths.app_folder', '')));
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
}
/**
* Get the services provided by the provider.
*/
public function provides(): array
{
return [];
}
private function getPublishableViewPaths(): array
{
$paths = [];
foreach (config('view.paths') as $path) {
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
$paths[] = $path . '/modules/' . $this->moduleNameLower;
}
}
return $paths;
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace Modules\Admin\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path('Admin', '/routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Admin', '/routes/api.php'));
}
}

View File

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface AppreciationInterface
{
public function findAll();
public function getAppreciationById($appreciationId);
public function delete($appreciationId);
public function create(array $appreciationDetails);
public function update($appreciationId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Appreciation;
class AppreciationRepository implements AppreciationInterface
{
public function findAll()
{
return Appreciation::get();
}
public function getAppreciationById($appreciationId)
{
return Appreciation::findOrFail($appreciationId);
}
public function delete($appreciationId)
{
Appreciation::destroy($appreciationId);
}
public function create(array $appreciationDetails)
{
return Appreciation::create($appreciationDetails);
}
public function update($appreciationId, array $newDetails)
{
return Appreciation::where('appreciation_id', $appreciationId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface CasteInterface
{
public function findAll();
public function getCasteById($casteId);
public function delete($casteId);
public function create(array $casteDetails);
public function update($casteId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Caste;
class CasteRepository implements CasteInterface
{
public function findAll()
{
return Caste::get();
}
public function getCasteById($casteId)
{
return Caste::findOrFail($casteId);
}
public function delete($casteId)
{
Caste::destroy($casteId);
}
public function create(array $casteDetails)
{
return Caste::create($casteDetails);
}
public function update($casteId, array $newDetails)
{
return Caste::where('id', $casteId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface CityInterface
{
public function findAll();
public function getCityById($cityId);
public function delete($cityId);
public function create(array $cityDetails);
public function update($cityId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\City;
class CityRepository implements CityInterface
{
public function findAll()
{
return City::get();
}
public function getCityById($cityId)
{
return City::findOrFail($cityId);
}
public function delete($cityId)
{
City::destroy($cityId);
}
public function create(array $cityDetails)
{
return City::create($cityDetails);
}
public function update($cityId, array $newDetails)
{
return City::where('id', $cityId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface CompanyInterface
{
public function findAll();
public function getCompanyById($companyId);
public function delete($companyId);
public function create(array $companyDetails);
public function update($companyId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Company;
class CompanyRepository implements CompanyInterface
{
public function findAll()
{
return Company::get();
}
public function getCompanyById($companyId)
{
return Company::findOrFail($companyId);
}
public function delete($companyId)
{
Company::destroy($companyId);
}
public function create(array $companyDetails)
{
return Company::create($companyDetails);
}
public function update($companyId, array $newDetails)
{
return Company::where('id', $companyId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface CompanyTypeInterface
{
public function findAll();
public function getCompanyTypeById($companyTypeId);
public function delete($companyTypeId);
public function create(array $companyTypeDetails);
public function update($companyTypeId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\CompanyType;
class CompanyTypeRepository implements CompanyTypeInterface
{
public function findAll()
{
return CompanyType::get();
}
public function getCompanyTypeById($companyTypeId)
{
return CompanyType::findOrFail($companyTypeId);
}
public function delete($companyTypeId)
{
CompanyType::destroy($companyTypeId);
}
public function create(array $companyTypeDetails)
{
return CompanyType::create($companyTypeDetails);
}
public function update($companyTypeId, array $newDetails)
{
return CompanyType::where('id', $companyTypeId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface ComplaintInterface
{
public function findAll();
public function getComplaintById($complaintId);
public function delete($complaintId);
public function create(array $complaintDetails);
public function update($complaintId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Complaint;
class ComplaintRepository implements ComplaintInterface
{
public function findAll()
{
return Complaint::get();
}
public function getComplaintById($complaintId)
{
return Complaint::findOrFail($complaintId);
}
public function delete($complaintId)
{
Complaint::destroy($complaintId);
}
public function create(array $complaintDetails)
{
return Complaint::create($complaintDetails);
}
public function update($complaintId, array $newDetails)
{
return Complaint::where('complaint_id', $complaintId)->update($newDetails);
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Modules\Admin\Repositories;
interface CountryInterface
{
public function findAll();
public function getCountryById($countryId);
public function delete($countryId);
public function create(array $countryDetails);
public function update($countryId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Country;
class CountryRepository implements CountryInterface
{
public function findAll()
{
return Country::get();
}
public function getCountryById($countryId)
{
return Country::findOrFail($countryId);
}
public function delete($countryId)
{
Country::destroy($countryId);
}
public function create(array $countryDetails)
{
return Country::create($countryDetails);
}
public function update($countryId, array $newDetails)
{
return Country::where('id', $countryId)->update($newDetails);
}
public function pluck(){
return Country::pluck('name','id');
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Modules\Admin\Repositories;
interface DepartmentInterface
{
public function pluck();
public function findAll();
public function getDepartmentById($departmentId);
public function delete($departmentId);
public function create(array $departmentDetails);
public function update($departmentId, array $newDetails);
}

View File

@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Department;
class DepartmentRepository implements DepartmentInterface
{
public function findAll()
{
return Department::get();
}
public function getDepartmentById($departmentId)
{
return Department::findOrFail($departmentId);
}
public function delete($departmentId)
{
Department::destroy($departmentId);
}
public function create(array $departmentDetails)
{
return Department::create($departmentDetails);
}
public function update($departmentId, array $newDetails)
{
return Department::where('department_id', $departmentId)->update($newDetails);
}
public function pluck(){
return Department::pluck('name','department_id');
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Modules\Admin\Repositories;
interface DesignationInterface
{
public function findAll();
public function getDesignationById($designationId);
public function delete($designationId);
public function create(array $designationDetails);
public function update($designationId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Designation;
class DesignationRepository implements DesignationInterface
{
public function findAll()
{
return Designation::get();
}
public function getDesignationById($designationId)
{
return Designation::findOrFail($designationId);
}
public function delete($designationId)
{
Designation::destroy($designationId);
}
public function create(array $designationDetails)
{
return Designation::create($designationDetails);
}
public function update($designationId, array $newDetails)
{
return Designation::where('designation_id', $designationId)->update($newDetails);
}
public function pluck(){
return Designation::pluck('name','designation_id');
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface DistrictInterface
{
public function findAll();
public function getDistrictById($districtId);
public function delete($districtId);
public function create(array $districtDetails);
public function update($districtId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\District;
class DistrictRepository implements DistrictInterface
{
public function findAll()
{
return District::get();
}
public function getDistrictById($districtId)
{
return District::findOrFail($districtId);
}
public function delete($districtId)
{
District::destroy($districtId);
}
public function create(array $districtDetails)
{
return District::create($districtDetails);
}
public function update($districtId, array $newDetails)
{
return District::where('id', $districtId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface DropdownInterface
{
public function findAll();
public function getDropdownById($DropdownId);
public function delete($DropdownId);
public function create(array $DropdownDetails);
public function update($DropdownId, array $newDetails);
}

View File

@ -0,0 +1,34 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Dropdown;
class DropdownRepository implements DropdownInterface
{
public function findAll()
{
return Dropdown::get();
}
public function getDropdownById($DropdownId)
{
return Dropdown::findOrFail($DropdownId);
}
public function delete($DropdownId)
{
Dropdown::destroy($DropdownId);
}
public function create(array $DropdownDetails)
{
return Dropdown::create($DropdownDetails);
}
public function update($DropdownId, array $newDetails)
{
return Dropdown::where('id', $DropdownId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface EthnicityInterface
{
public function findAll();
public function getEthnicityById($ethnicityId);
public function delete($ethnicityId);
public function create(array $ethnicityDetails);
public function update($ethnicityId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Ethnicity;
class EthnicityRepository implements EthnicityInterface
{
public function findAll()
{
return Ethnicity::get();
}
public function getEthnicityById($ethnicityId)
{
return Ethnicity::findOrFail($ethnicityId);
}
public function delete($ethnicityId)
{
Ethnicity::destroy($ethnicityId);
}
public function create(array $ethnicityDetails)
{
return Ethnicity::create($ethnicityDetails);
}
public function update($ethnicityId, array $newDetails)
{
return Ethnicity::where('id', $ethnicityId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface EventInterface
{
public function findAll($filters = [], $limit = null, $offset = null);
public function getEventById($eventId);
public function delete($eventId);
public function create(array $eventDetails);
public function update($eventId, array $newDetails);
}

View File

@ -0,0 +1,43 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Event;
class EventRepository implements EventInterface
{
public function findAll($filters = [], $limit = null, $offset = null)
{
return Event::when($filters, function ($query) use ($filters) {
if (isset($filters["start_date"])) {
$query->whereDate("start_date", ">=", $filters["start_date"]);
}
if (isset($filters["end_date"])) {
$query->whereDate("end_date", "<=", $filters["end_date"]);
}
})->latest()->get();
}
public function getEventById($eventId)
{
return Event::findOrFail($eventId);
}
public function delete($eventId)
{
Event::destroy($eventId);
}
public function create(array $eventDetails)
{
return Event::create($eventDetails);
}
public function update($eventId, array $newDetails)
{
return Event::where('event_id', $eventId)->update($newDetails);
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Modules\Admin\Repositories;
interface FieldInterface
{
public function findAll();
public function getFieldById($FieldId);
public function getList();
public function getDropdownByAlias($alias);
public function delete($FieldId);
public function create(array $FieldDetails);
public function update($FieldId, array $newDetails);
}

View File

@ -0,0 +1,48 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Field;
class FieldRepository implements FieldInterface
{
public function findAll()
{
return Field::get();
}
public function getFieldById($FieldId)
{
return Field::findOrFail($FieldId);
}
public function getList()
{
return Field::pluck('title', 'id');
}
public function getDropdownByAlias($alias)
{
$fieldModel = Field::where("alias", $alias)->first();
if ($fieldModel) {
return $fieldModel->dropdown()->pluck('title', 'id');
}
}
public function delete($FieldId)
{
Field::destroy($FieldId);
}
public function create(array $FieldDetails)
{
return Field::create($FieldDetails);
}
public function update($FieldId, array $newDetails)
{
return Field::where('id', $FieldId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface GenderInterface
{
public function findAll();
public function getGenderById($genderId);
public function delete($genderId);
public function create(array $genderDetails);
public function update($genderId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Gender;
class GenderRepository implements GenderInterface
{
public function findAll()
{
return Gender::get();
}
public function getGenderById($genderId)
{
return Gender::findOrFail($genderId);
}
public function delete($genderId)
{
Gender::destroy($genderId);
}
public function create(array $genderDetails)
{
return Gender::create($genderDetails);
}
public function update($genderId, array $newDetails)
{
return Gender::where('id', $genderId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface HolidayInterface
{
public function findAll();
public function getHolidayById($holidayId);
public function delete($holidayId);
public function create(array $holidayDetails);
public function update($holidayId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Holiday;
class HolidayRepository implements HolidayInterface
{
public function findAll()
{
return Holiday::get();
}
public function getHolidayById($holidayId)
{
return Holiday::findOrFail($holidayId);
}
public function delete($holidayId)
{
Holiday::destroy($holidayId);
}
public function create(array $holidayDetails)
{
return Holiday::create($holidayDetails);
}
public function update($holidayId, array $newDetails)
{
return Holiday::where('holiday_id', $holidayId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface MunicipalityInterface
{
public function findAll();
public function getMunicipalityById($municipalityId);
public function delete($municipalityId);
public function create(array $municipalityDetails);
public function update($municipalityId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Municipality;
class MunicipalityRepository implements MunicipalityInterface
{
public function findAll()
{
return Municipality::get();
}
public function getMunicipalityById($municipalityId)
{
return Municipality::findOrFail($municipalityId);
}
public function delete($municipalityId)
{
Municipality::destroy($municipalityId);
}
public function create(array $municipalityDetails)
{
return Municipality::create($municipalityDetails);
}
public function update($municipalityId, array $newDetails)
{
return Municipality::where('id', $municipalityId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface NationalityInterface
{
public function findAll();
public function getNationalityById($nationalityId);
public function delete($nationalityId);
public function create(array $nationalityDetails);
public function update($nationalityId, array $newDetails);
}

Some files were not shown because too many files have changed in this diff Show More