firstcommit

This commit is contained in:
Dharmaraj Shrestha 2024-05-16 09:31:08 +05:45
commit 34d9672cb8
1396 changed files with 86482 additions and 0 deletions

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

64
.env.example Normal file
View File

@ -0,0 +1,64 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
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
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

20
.gitignore vendored Normal file
View File

@ -0,0 +1,20 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode

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,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,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,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 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,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,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,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

View File

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,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,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,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,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,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

View File

@ -0,0 +1,121 @@
<?php
namespace Modules\Admin\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\DropdownRepository;
use Modules\Admin\Repositories\FieldInterface;
use Modules\Admin\Repositories\FieldRepository;
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->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,12 @@
<?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);
}

View File

@ -0,0 +1,35 @@
<?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);
}
}

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);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Nationality;
class NationalityRepository implements NationalityInterface
{
public function findAll()
{
return Nationality::get();
}
public function getNationalityById($nationalityId)
{
return Nationality::findOrFail($nationalityId);
}
public function delete($nationalityId)
{
Nationality::destroy($nationalityId);
}
public function create(array $nationalityDetails)
{
return Nationality::create($nationalityDetails);
}
public function update($nationalityId, array $newDetails)
{
return Nationality::where('id', $nationalityId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface ProgressStatusInterface
{
public function findAll();
public function getProgressStatusById($progressStatusId);
public function delete($progressStatusId);
public function create(array $progressStatusDetails);
public function update($progressStatusId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\ProgressStatus;
class ProgressStatusRepository implements ProgressStatusInterface
{
public function findAll()
{
return ProgressStatus::get();
}
public function getProgressStatusById($progressStatusId)
{
return ProgressStatus::findOrFail($progressStatusId);
}
public function delete($progressStatusId)
{
ProgressStatus::destroy($progressStatusId);
}
public function create(array $progressStatusDetails)
{
return ProgressStatus::create($progressStatusDetails);
}
public function update($progressStatusId, array $newDetails)
{
return ProgressStatus::where('id', $progressStatusId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface PromotionDemotionInterface
{
public function findAll();
public function getPromotionDemotionById($promotionDemotionId);
public function delete($promotionDemotionId);
public function create(array $promotionDemotionDetails);
public function update($promotionDemotionId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\PromotionDemotion;
class PromotionDemotionRepository implements PromotionDemotionInterface
{
public function findAll()
{
return PromotionDemotion::get();
}
public function getPromotionDemotionById($promotionDemotionId)
{
return PromotionDemotion::findOrFail($promotionDemotionId);
}
public function delete($promotionDemotionId)
{
PromotionDemotion::destroy($promotionDemotionId);
}
public function create(array $promotionDemotionDetails)
{
return PromotionDemotion::create($promotionDemotionDetails);
}
public function update($promotionDemotionId, array $newDetails)
{
return PromotionDemotion::whereId($promotionDemotionId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface ProvinceInterface
{
public function findAll();
public function getProvinceById($provinceId);
public function delete($provinceId);
public function create(array $provinceDetails);
public function update($provinceId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Province;
class ProvinceRepository implements ProvinceInterface
{
public function findAll()
{
return Province::get();
}
public function getProvinceById($provinceId)
{
return Province::findOrFail($provinceId);
}
public function delete($provinceId)
{
Province::destroy($provinceId);
}
public function create(array $provinceDetails)
{
return Province::create($provinceDetails);
}
public function update($provinceId, array $newDetails)
{
return Province::where('id', $provinceId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface ResignationInterface
{
public function findAll();
public function getResignationById($resignationId);
public function delete($resignationId);
public function create(array $resignationDetails);
public function update($resignationId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Resignation;
class ResignationRepository implements ResignationInterface
{
public function findAll()
{
return Resignation::get();
}
public function getResignationById($resignationId)
{
return Resignation::findOrFail($resignationId);
}
public function delete($resignationId)
{
Resignation::destroy($resignationId);
}
public function create(array $resignationDetails)
{
return Resignation::create($resignationDetails);
}
public function update($resignationId, array $newDetails)
{
return Resignation::where('resignation_id', $resignationId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface TransferInterface
{
public function findAll();
public function getTransferById($transferId);
public function delete($transferId);
public function create(array $transferDetails);
public function update($transferId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Transfer;
class TransferRepository implements TransferInterface
{
public function findAll()
{
return Transfer::get();
}
public function getTransferById($transferId)
{
return Transfer::findOrFail($transferId);
}
public function delete($transferId)
{
Transfer::destroy($transferId);
}
public function create(array $transferDetails)
{
return Transfer::create($transferDetails);
}
public function update($transferId, array $newDetails)
{
return Transfer::where('transfer_id', $transferId)->update($newDetails);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Modules\Admin\Repositories;
interface WarningInterface
{
public function findAll();
public function getWarningById($warningId);
public function delete($warningId);
public function create(array $warningDetails);
public function update($warningId, array $newDetails);
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\Warning;
class WarningRepository implements WarningInterface
{
public function findAll()
{
return Warning::get();
}
public function getWarningById($warningId)
{
return Warning::findOrFail($warningId);
}
public function delete($warningId)
{
Warning::destroy($warningId);
}
public function create(array $warningDetails)
{
return Warning::create($warningDetails);
}
public function update($warningId, array $newDetails)
{
return Warning::where('warning_id', $warningId)->update($newDetails);
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Modules\Admin\Repositories;
interface WorkShiftInterface
{
public function findAll();
public function getWorkShiftById($workShiftId);
public function delete($workShiftId);
public function create(array $workShiftDetails);
public function update($workShiftId, array $newDetails);
public function pluck();
}

View File

@ -0,0 +1,39 @@
<?php
namespace Modules\Admin\Repositories;
use Modules\Admin\Models\WorkShift;
class WorkShiftRepository implements WorkShiftInterface
{
public function findAll()
{
return WorkShift::get();
}
public function getWorkShiftById($workShiftId)
{
return WorkShift::findOrFail($workShiftId);
}
public function delete($workShiftId)
{
WorkShift::destroy($workShiftId);
}
public function create(array $workShiftDetails)
{
return WorkShift::create($workShiftDetails);
}
public function update($workShiftId, array $newDetails)
{
return WorkShift::where('work_shift_id', $workShiftId)->update($newDetails);
}
public function pluck(){
return WorkShift::pluck('name','work_shift_id');
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace Modules\Admin\Services;
use Modules\Admin\Models\Caste;
use Modules\Admin\Models\City;
use Modules\Admin\Models\Company;
use Modules\Admin\Models\CompanyType;
use Modules\Admin\Models\Country;
use Modules\Admin\Models\Department;
use Modules\Admin\Models\Designation;
use Modules\Admin\Models\District;
use Modules\Admin\Models\Gender;
use Modules\Admin\Models\Nationality;
use Modules\Admin\Models\Province;
final class AdminService
{
function pluckCountries()
{
return Country::pluck('name', 'id');
}
function pluckCompanyTypes()
{
return CompanyType::pluck('name', 'id');
}
function pluckCompanies()
{
return Company::pluck('name', 'id');
}
function pluckProvinces()
{
return Province::pluck('name', 'id');
}
function pluckDistricts()
{
return District::pluck('name', 'id');
}
function pluckCities()
{
return City::pluck('name', 'id');
}
function pluckCastes()
{
return Caste::pluck('name', 'id');
}
function pluckGenders()
{
return Gender::pluck('name', 'id');
}
function pluckNationalities()
{
return Nationality::pluck('name', 'id');
}
function pluckDepartments()
{
return Department::pluck('name', 'department_id');
}
function pluckDesignations()
{
return Designation::pluck('name', 'designation_id');
}
}

View File

@ -0,0 +1,30 @@
{
"name": "nwidart/admin",
"description": "",
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\Admin\\": "app/",
"Modules\\Admin\\Database\\Factories\\": "database/factories/",
"Modules\\Admin\\Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Modules\\Admin\\Tests\\": "tests/"
}
}
}

View File

View File

@ -0,0 +1,5 @@
<?php
return [
'name' => 'Admin',
];

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_promotion_demotions', function (Blueprint $table) {
$table->id();
$table->string('title')->nullable();
$table->string('alias')->nullable();
$table->unsignedBigInteger('employee_id')->nullable();
$table->unsignedBigInteger('old_designation_id')->nullable();
$table->unsignedBigInteger('new_designation_id')->nullable();
$table->string('type')->nullable();
$table->date('date')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_promotion_demotions');
}
};

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_appreciations', function (Blueprint $table) {
$table->tinyInteger('appreciation_id')->unsigned()->autoIncrement();
$table->string('title')->nullable();
$table->string('alias')->nullable();
$table->unsignedBigInteger('type')->nullable();
$table->unsignedBigInteger('employee_id')->nullable();
$table->unsignedBigInteger('appreciated_by')->nullable();
$table->date('appreciated_date')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_appreciations');
}
};

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_resignations', function (Blueprint $table) {
$table->tinyInteger('resignation_id')->unsigned()->autoIncrement();
$table->unsignedBigInteger('employee_id')->nullable();
$table->date('resignation_date')->nullable();
$table->unsignedBigInteger('resignation_type')->nullable();
$table->date('approved_date')->nullable();
$table->unsignedBigInteger('approved_by')->nullable();
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->integer('status')->default(11);
$table->integer('progress_status_id')->default(1);
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_resignations');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_complaints', function (Blueprint $table) {
$table->tinyInteger('complaint_id')->unsigned()->autoIncrement();
$table->unsignedBigInteger('employee_id')->nullable();
$table->date('complaint_date')->nullable();
$table->unsignedBigInteger('complaint_by')->nullable();
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->integer('status')->default(11);
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_complaints');
}
};

View File

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_transfers', function (Blueprint $table) {
$table->tinyInteger('transfer_id')->unsigned()->autoIncrement();
$table->unsignedBigInteger('employee_id')->nullable();
$table->unsignedBigInteger('old_department_id')->nullable();
$table->unsignedBigInteger('new_department_id')->nullable();
$table->unsignedBigInteger('approved_by')->nullable();
$table->date('approved_date')->nullable();
$table->unsignedBigInteger('progress_status_id')->default(1);
$table->integer('status')->default(11);
$table->date('transfer_date')->nullable();
$table->unsignedBigInteger('transfer_type')->nullable();
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_transfers');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_warnings', function (Blueprint $table) {
$table->tinyInteger('warning_id')->unsigned()->autoIncrement();
$table->unsignedBigInteger('employee_id')->nullable();
$table->unsignedBigInteger('reason')->nullable();
$table->unsignedBigInteger('type')->nullable();
$table->date('warning_date')->nullable();
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->integer('status')->default(11);
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_warnings');
}
};

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_companies', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('address')->nullable();
$table->unsignedBigInteger('company_type_id')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->string('bank_name')->nullable();
$table->string('bank_acc_no')->nullable();
$table->string('bank_acc_branch')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_companies');
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_company_types', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_company_types');
}
};

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_events', function (Blueprint $table) {
$table->unsignedTinyInteger('event_id')->autoIncrement();
$table->string('title')->nullable();
$table->string('type')->nullable();
$table->dateTime('start_date')->nullable();
$table->dateTime('end_date')->nullable();
// $table->time('start_time')->nullable();
// $table->time('end_time')->nullable();
$table->unsignedBigInteger('department_id')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->string('location')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_events');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_holidays', function (Blueprint $table) {
$table->unsignedTinyInteger('holiday_id')->autoIncrement();
$table->string('title')->nullable();
$table->string('start_date')->nullable();
$table->string('end_date')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_holidays');
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_departments', function (Blueprint $table) {
$table->unsignedTinyInteger('department_id')->autoIncrement();
$table->string('name')->nullable();
$table->unsignedBigInteger('employee_id')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_departments');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_designations', function (Blueprint $table) {
$table->unsignedTinyInteger('designation_id')->autoIncrement();
$table->string('name')->nullable();
$table->unsignedBigInteger('department_id')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_designations');
}
};

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_work_shifts', function (Blueprint $table) {
$table->unsignedTinyInteger('work_shift_id')->autoIncrement();
$table->string('name')->nullable();
$table->time('min_start_time')->nullable();
$table->time('start_time')->nullable();
$table->time('max_start_time')->nullable();
$table->time('min_end_time')->nullable();
$table->time('end_time')->nullable();
$table->time('max_end_time')->nullable();
$table->integer('break_time')->nullable();
$table->integer('status')->default(11);
$table->mediumText('description')->nullable();
$table->mediumText('remarks')->nullable();
$table->mediumText('createdBy')->nullable();
$table->mediumText('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_work_shifts');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_countries', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('code')->nullable();
$table->integer('status')->default(11);
$table->text('description')->nullable();
$table->text('remarks')->nullable();
$table->integer('createdBy')->nullable();
$table->integer('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_countries');
}
};

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_provinces', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('country_id')->nullable();
$table->string('name')->nullable();
$table->integer('status')->default(11);
$table->text('description')->nullable();
$table->text('remarks')->nullable();
$table->unsignedInteger('createdBy')->nullable();
$table->unsignedInteger('updatedby')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_provinces');
}
};

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('tbl_castes', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->integer('status')->default(11);
$table->text('description')->nullable();
$table->text('remarks')->nullable();
$table->unsignedBigInteger('createdBy')->nullable();
$table->unsignedBigInteger('updatedBy')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tbl_castes');
}
};

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