diff --git a/Modules/Leave/app/Http/Controllers/LeaveController.php b/Modules/Leave/app/Http/Controllers/LeaveController.php index 236e547..5d3b68b 100644 --- a/Modules/Leave/app/Http/Controllers/LeaveController.php +++ b/Modules/Leave/app/Http/Controllers/LeaveController.php @@ -33,8 +33,7 @@ class LeaveController extends Controller { $data['leaves'] = $this->leaveRepository->findAll(); $data['employeeList'] = $this->employeeRepository->pluck(); - - return view('leave::index', $data); + return view('leave::leave.index', $data); } /** @@ -44,7 +43,7 @@ class LeaveController extends Controller { $data['title'] = 'Create Leave'; $data['employeeList'] = $this->employeeRepository->pluck(); - return view('leave::create', $data); + return view('leave::leave.create', $data); } /** @@ -67,7 +66,7 @@ class LeaveController extends Controller */ public function show($id) { - return view('leave::show'); + return view('leave::leave.show'); } /** @@ -79,7 +78,7 @@ class LeaveController extends Controller $data['leave'] = $this->leaveRepository->getLeaveById($id); - return view('leave::edit', $data); + return view('leave::leave.edit', $data); } /** diff --git a/Modules/Leave/app/Http/Controllers/LeaveTypeController.php b/Modules/Leave/app/Http/Controllers/LeaveTypeController.php new file mode 100644 index 0000000..f07bace --- /dev/null +++ b/Modules/Leave/app/Http/Controllers/LeaveTypeController.php @@ -0,0 +1,80 @@ +leaveRepository = $leaveRepository; + $this->leaveTypeRepository = $leaveTypeRepository; + } + /** + * Display a listing of the resource. + */ + public function index() + { + $data['leaveTypes'] = $this->leaveTypeRepository->findAll(); + return view('leave::leave-type.index', $data); + } + + /** + * Show the form for creating a new resource. + */ + public function create() + { + $data['title'] = 'Create Leave Type'; + + return view('leave::leave-type.create', $data); + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request): RedirectResponse + { + // + } + + /** + * Show the specified resource. + */ + public function show($id) + { + return view('leave::leave-type.show'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit($id) + { + return view('leave::leave-type.edit'); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id): RedirectResponse + { + // + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + // + } +} diff --git a/Modules/Leave/app/Http/Requests/LeaveTypeRequest.php b/Modules/Leave/app/Http/Requests/LeaveTypeRequest.php new file mode 100644 index 0000000..76c9601 --- /dev/null +++ b/Modules/Leave/app/Http/Requests/LeaveTypeRequest.php @@ -0,0 +1,26 @@ +app->bind(LeaveInterface::class, LeaveRepository::class); + $this->app->bind(LeaveTypeInterface::class, LeaveTypeRepository::class); + $this->app->register(RouteServiceProvider::class); } @@ -60,7 +63,7 @@ class LeaveServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/' . $this->moduleNameLower); if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, $this->moduleNameLower); @@ -76,7 +79,7 @@ class LeaveServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); + $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); } @@ -85,14 +88,14 @@ class LeaveServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); + $viewPath = resource_path('views/modules/' . $this->moduleNameLower); $sourcePath = module_path($this->moduleName, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-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',''))); + $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); } @@ -108,8 +111,8 @@ class LeaveServiceProvider extends ServiceProvider { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path . '/modules/' . $this->moduleNameLower)) { + $paths[] = $path . '/modules/' . $this->moduleNameLower; } } diff --git a/Modules/Leave/app/Repositories/LeaveTypeInterface.php b/Modules/Leave/app/Repositories/LeaveTypeInterface.php new file mode 100644 index 0000000..870e937 --- /dev/null +++ b/Modules/Leave/app/Repositories/LeaveTypeInterface.php @@ -0,0 +1,12 @@ +update($newDetails); + } + +} diff --git a/Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php b/Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php index 0accbdc..9c2834b 100644 --- a/Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php +++ b/Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php @@ -11,11 +11,12 @@ return new class extends Migration */ public function up(): void { - Schema::create('leaves', function (Blueprint $table) { + Schema::create('tbl_leaves', function (Blueprint $table) { $table->tinyInteger('leave_id')->unsigned()->autoIncrement(); - $table->integer('employee_id'); - $table->date('start_date'); - $table->date('end_date'); + $table->unsignedBigInteger('employee_id'); + $table->unsignedBigInteger('leave_type_id'); + $table->date('start_date')->nullable(); + $table->date('end_date')->nullable(); $table->timestamps(); }); } @@ -25,6 +26,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('leaves'); + Schema::dropIfExists('tbl_leaves'); } }; diff --git a/Modules/Leave/database/migrations/2024_04_11_110941_create_leave_types_table.php b/Modules/Leave/database/migrations/2024_04_11_110941_create_leave_types_table.php new file mode 100644 index 0000000..774ff92 --- /dev/null +++ b/Modules/Leave/database/migrations/2024_04_11_110941_create_leave_types_table.php @@ -0,0 +1,31 @@ +tinyInteger('leave_type_id')->unsigned()->autoIncrement(); + $table->string('title'); + $table->integer('status')->default(11); + $table->integer('createdBy')->nullable(); + $table->integer('updatedBy')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('tbl_leave_types'); + } +}; diff --git a/Modules/Leave/resources/views/leave-type/create.blade.php b/Modules/Leave/resources/views/leave-type/create.blade.php new file mode 100644 index 0000000..8fab614 --- /dev/null +++ b/Modules/Leave/resources/views/leave-type/create.blade.php @@ -0,0 +1,30 @@ +@extends('layouts.app') + +@section('content') +
S.N | +Leave Type | +Created By | +Status | +Action | +|
---|---|---|---|---|---|
{{ $key + 1 }} | +{{ $leaveType->employee_id }} | +{{ $leaveType->start_date }} | +{{ $leaveType->end_date }} | +{{ $leaveType->created_at }} | ++ + | +