remove leave module

This commit is contained in:
Ranjan 2024-04-05 10:16:48 +05:45
parent 3324d7e3ae
commit f4718d7d55
14 changed files with 0 additions and 380 deletions

View File

@ -1,84 +0,0 @@
<?php
namespace Modules\Leave\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Leave\Repositories\LeaveInterface;
class LeaveController extends Controller
{
private LeaveInterface $leaveRepository;
public function __construct(LeaveInterface $leaveRepository)
{
$this->leaveRepository = $leaveRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['leaves'] = $this->leaveRepository->findAll();
// dd($data['leaves']);
return view('leave::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Leave';
return view('leave::create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
$this->leaveRepository->create($inputData);
toastr()->success('Leave Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('leave.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('leave::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('leave::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

@ -1,12 +0,0 @@
<?php
namespace Modules\Leave\Models;
use Illuminate\Database\Eloquent\Model;
class Leave extends Model
{
protected $table = 'leaves';
protected $guarded = [];
}

View File

@ -1,118 +0,0 @@
<?php
namespace Modules\Leave\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
use Modules\Leave\Repositories\LeaveInterface;
use Modules\Leave\Repositories\LeaveRepository;
class LeaveServiceProvider extends ServiceProvider
{
protected string $moduleName = 'Leave';
protected string $moduleNameLower = 'leave';
/**
* 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(LeaveInterface::class, LeaveRepository::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

@ -1,49 +0,0 @@
<?php
namespace Modules\Leave\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('Leave', '/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('Leave', '/routes/api.php'));
}
}

View File

@ -1,12 +0,0 @@
<?php
namespace Modules\Leave\Repositories;
interface LeaveInterface
{
public function findAll();
public function getLeaveById($leaveId);
public function delete($leaveId);
public function create(array $LeaveDetails);
public function update($leaveId, array $newDetails);
}

View File

@ -1,34 +0,0 @@
<?php
namespace Modules\Leave\Repositories;
use Modules\Leave\Models\Leave;
class LeaveRepository implements LeaveInterface
{
public function findAll()
{
return Leave::get();
}
public function getLeaveById($leaveId)
{
return Leave::findOrFail($leaveId);
}
public function delete($leaveId)
{
Leave::destroy($leaveId);
}
public function create(array $leaveDetails)
{
return Leave::create($leaveDetails);
}
public function update($leaveId, array $newDetails)
{
return Leave::whereId($leaveId)->update($newDetails);
}
}

View File

@ -1,44 +0,0 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<form action="{{ route('leave.store') }}" method="post" class="needs-validation" novalidate>
@csrf
@include('leave::partials.action')
</form>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -1,27 +0,0 @@
<div class="mb-3">
<label for="employeeName" class="form-label">Employee Name</label>
<input type="text" class="form-control" id="employeeName" placeholder="Enter emploree name" name="employeeName"
required>
<div class="invalid-feedback">
Please enter Employee Name.
</div>
</div>
<div class="mb-3">
<label for="employeeUrl" class="form-label">Employee Department URL</label>
<input type="url" class="form-control" id="employeeUrl" placeholder="Enter emploree url" name="employeeUrl">
</div>
<div class="mb-3">
<label for="StartleaveDate" class="form-label">Start Leave Date</label>
<input type="date" class="form-control" id="StartleaveDate" name="start_date">
</div>
<div class="mb-3">
<label for="EndleaveDate" class="form-label">End Leave Date</label>
<input type="date" class="form-control" id="EndleaveDate" name="end_date">
</div>
<div class="mb-3">
<label for="VertimeassageInput" class="form-label">Message</label>
<textarea class="form-control" id="VertimeassageInput" rows="3" placeholder="Enter your message" name="remark"></textarea>
</div>
<div class="text-end">
<button type="submit" class="btn btn-primary">Add Leave</button>
</div>