From dfdc927a56c2a6c7e7d2c1780da62017197d0e58 Mon Sep 17 00:00:00 2001 From: Ranjan Date: Thu, 4 Apr 2024 17:53:23 +0545 Subject: [PATCH 1/6] migration issues --- .../Http/Controllers/LeaveController.php | 10 +- Modules/Leave/Models/Leave.php | 14 +- .../Leave/Providers/LeaveServiceProvider.php | 17 +- .../Leave/Repositories/LeaveRepository.php | 2 +- .../2024_04_04_102430_create_leaves_table.php | 6 +- .../Leave/resources/views/create.blade.php | 3 +- .../resources/views/partials/action.blade.php | 10 +- app/Helpers/OMIS.php | 355 +++++++++--------- composer.json | 7 +- package-lock.json | 2 +- routes/web.php | 6 +- 11 files changed, 213 insertions(+), 219 deletions(-) diff --git a/Modules/Leave/Http/Controllers/LeaveController.php b/Modules/Leave/Http/Controllers/LeaveController.php index 11913b7..7f65e29 100644 --- a/Modules/Leave/Http/Controllers/LeaveController.php +++ b/Modules/Leave/Http/Controllers/LeaveController.php @@ -22,6 +22,7 @@ class LeaveController extends Controller public function index() { $data['leaves'] = $this->leaveRepository->findAll(); + // dd($data['leaves']); return view('leave::index'); } @@ -39,7 +40,14 @@ class LeaveController extends Controller */ public function store(Request $request): RedirectResponse { - dd($request->all()); + $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'); } /** diff --git a/Modules/Leave/Models/Leave.php b/Modules/Leave/Models/Leave.php index 64d02eb..0739923 100644 --- a/Modules/Leave/Models/Leave.php +++ b/Modules/Leave/Models/Leave.php @@ -3,20 +3,10 @@ namespace Modules\Leave\Models; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Factories\HasFactory; -use Modules\Leave\Database\factories\LeaveFactory; class Leave extends Model { - use HasFactory; + protected $table = 'tbl_leaves'; + protected $guarded = []; - /** - * The attributes that are mass assignable. - */ - protected $fillable = []; - - protected static function newFactory(): LeaveFactory - { - //return LeaveFactory::new(); - } } diff --git a/Modules/Leave/Providers/LeaveServiceProvider.php b/Modules/Leave/Providers/LeaveServiceProvider.php index 12d7d98..0dcaf5c 100644 --- a/Modules/Leave/Providers/LeaveServiceProvider.php +++ b/Modules/Leave/Providers/LeaveServiceProvider.php @@ -4,6 +4,8 @@ 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 { @@ -29,6 +31,7 @@ class LeaveServiceProvider extends ServiceProvider */ public function register(): void { + $this->app->bind(LeaveInterface::class, LeaveRepository::class); $this->app->register(RouteServiceProvider::class); } @@ -56,7 +59,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); @@ -72,7 +75,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); } @@ -81,14 +84,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); } @@ -104,8 +107,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/Repositories/LeaveRepository.php b/Modules/Leave/Repositories/LeaveRepository.php index 62ff34c..abdb3a5 100644 --- a/Modules/Leave/Repositories/LeaveRepository.php +++ b/Modules/Leave/Repositories/LeaveRepository.php @@ -8,7 +8,7 @@ class LeaveRepository implements LeaveInterface { public function findAll() { - return Leave::all(); + return Leave::get(); } public function getLeaveById($leaveId) 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 29e656a..0accbdc 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 @@ -12,8 +12,10 @@ return new class extends Migration public function up(): void { Schema::create('leaves', function (Blueprint $table) { - $table->id(); - + $table->tinyInteger('leave_id')->unsigned()->autoIncrement(); + $table->integer('employee_id'); + $table->date('start_date'); + $table->date('end_date'); $table->timestamps(); }); } diff --git a/Modules/Leave/resources/views/create.blade.php b/Modules/Leave/resources/views/create.blade.php index c1393bb..c56be23 100644 --- a/Modules/Leave/resources/views/create.blade.php +++ b/Modules/Leave/resources/views/create.blade.php @@ -24,7 +24,8 @@
-
+ + @csrf @include('leave::partials.action')
diff --git a/Modules/Leave/resources/views/partials/action.blade.php b/Modules/Leave/resources/views/partials/action.blade.php index c33288d..04ce95d 100644 --- a/Modules/Leave/resources/views/partials/action.blade.php +++ b/Modules/Leave/resources/views/partials/action.blade.php @@ -1,22 +1,22 @@
- +
- +
- +
- +
- +
diff --git a/app/Helpers/OMIS.php b/app/Helpers/OMIS.php index 5d980be..e799df7 100644 --- a/app/Helpers/OMIS.php +++ b/app/Helpers/OMIS.php @@ -185,7 +185,8 @@ class OMIS ]); } } - private function initDB() + + public static function initDB() { static $initialized = false; if (!$initialized) { @@ -225,64 +226,64 @@ class OMIS `updated_at` timestamp NULL DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; "); - DB::statement("CREATE TABLE IF NOT EXISTS `tbl_users` ( - `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, - `name` varchar(255) NULL, - `email` varchar(255) NULL, - `username` varchar(255) NULL, - `email_verified_at` timestamp NULL DEFAULT NULL, - `password` varchar(255) NULL, - `remember_token` varchar(100) DEFAULT NULL, - `display_order` INT(11) DEFAULT 1, - `roles_id` INT(11), - `branches_id` INT(11), - `vendors_id` INT(11), - `employees_id` INT(11), - `status` INT(11) DEFAULT 1, - `created_at` timestamp NULL DEFAULT NULL, - `createdby` INT(11), - `updated_at` timestamp NULL DEFAULT NULL, - `updatedby` INT(11) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - "); - DB::statement("CREATE TABLE IF NOT EXISTS tbl_roles ( - role_id INT(11) AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(255), - alias VARCHAR(255), - description TEXT, - display_order INT(11), - status INT(11), - remarks TEXT, - created_at DATETIME, - createdby INT(11), - updated_at DATETIME, - updatedby INT(11) - );"); - DB::statement("CREATE TABLE IF NOT EXISTS tbl_permissions ( - permission_id INT(11) AUTO_INCREMENT PRIMARY KEY, - title VARCHAR(255), - alias VARCHAR(255), - modal VARCHAR(255), - command VARCHAR(255), - created_at DATETIME, - createdby INT(11), - updated_at DATETIME, - updatedby INT(11), - status INT(11) + // DB::statement("CREATE TABLE IF NOT EXISTS `tbl_users` ( + // `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + // `name` varchar(255) NULL, + // `email` varchar(255) NULL, + // `username` varchar(255) NULL, + // `email_verified_at` timestamp NULL DEFAULT NULL, + // `password` varchar(255) NULL, + // `remember_token` varchar(100) DEFAULT NULL, + // `display_order` INT(11) DEFAULT 1, + // `roles_id` INT(11), + // `branches_id` INT(11), + // `vendors_id` INT(11), + // `employees_id` INT(11), + // `status` INT(11) DEFAULT 1, + // `created_at` timestamp NULL DEFAULT NULL, + // `createdby` INT(11), + // `updated_at` timestamp NULL DEFAULT NULL, + // `updatedby` INT(11) + // ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + // "); + // DB::statement("CREATE TABLE IF NOT EXISTS tbl_roles ( + // role_id INT(11) AUTO_INCREMENT PRIMARY KEY, + // title VARCHAR(255), + // alias VARCHAR(255), + // description TEXT, + // display_order INT(11), + // status INT(11), + // remarks TEXT, + // created_at DATETIME, + // createdby INT(11), + // updated_at DATETIME, + // updatedby INT(11) + // );"); + // DB::statement("CREATE TABLE IF NOT EXISTS tbl_permissions ( + // permission_id INT(11) AUTO_INCREMENT PRIMARY KEY, + // title VARCHAR(255), + // alias VARCHAR(255), + // modal VARCHAR(255), + // command VARCHAR(255), + // created_at DATETIME, + // createdby INT(11), + // updated_at DATETIME, + // updatedby INT(11), + // status INT(11) - );"); - DB::statement("CREATE TABLE IF NOT EXISTS tbl_rolepermissions ( - rolepermission_id INT(11) AUTO_INCREMENT PRIMARY KEY, - roles_id INT(11), - permissions_id INT(11), - display_order INT(11), - remarks VARCHAR(255), - created_at DATETIME, - createdby INT(11), - updated_at DATETIME, - updatedby INT(11), - status INT(11) - );"); + // );"); + // DB::statement("CREATE TABLE IF NOT EXISTS tbl_rolepermissions ( + // rolepermission_id INT(11) AUTO_INCREMENT PRIMARY KEY, + // roles_id INT(11), + // permissions_id INT(11), + // display_order INT(11), + // remarks VARCHAR(255), + // created_at DATETIME, + // createdby INT(11), + // updated_at DATETIME, + // updatedby INT(11), + // status INT(11) + // );"); DB::statement("CREATE TABLE IF NOT EXISTS `tbl_settings` ( `setting_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` varchar(255) NULL, @@ -509,8 +510,7 @@ class OMIS ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; "); - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_castes` ( + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_castes` ( `caste_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` varchar(255) DEFAULT NULL, `alias` varchar(255) DEFAULT NULL, @@ -524,8 +524,7 @@ class OMIS ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; "); - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_ethnicities` ( + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_ethnicities` ( `ethnicity_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` varchar(255) DEFAULT NULL, `alias` varchar(255) DEFAULT NULL, @@ -539,8 +538,7 @@ class OMIS ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; "); - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_dags` ( + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_dags` ( `dag_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` varchar(255) DEFAULT NULL, `alias` varchar(255) DEFAULT NULL, @@ -554,83 +552,12 @@ class OMIS ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; "); - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_nationalities` ( - `nationality_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `title` varchar(255) DEFAULT NULL, - `alias` varchar(255) DEFAULT NULL, - `status` varchar(255) DEFAULT NULL, - `remarks` varchar(255) DEFAULT NULL, - `display_order` int(11) DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `createdby` int(11) DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `updatedby` int(11) DEFAULT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -"); - - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_employees` ( - `employee_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `first_name` varchar(255) DEFAULT NULL, - `middle_name` varchar(255) DEFAULT NULL, - `last_name` varchar(255) DEFAULT NULL, - `email` varchar(255) DEFAULT NULL, - `genders_id` int(11) DEFAULT NULL, - `nepali_dob` date DEFAULT NULL, - `dob` date DEFAULT NULL, - `nationalities_id` int(11) DEFAULT NULL, - `about_me` text, - `signature` varchar(255) DEFAULT NULL, - `father_name` varchar(255) DEFAULT NULL, - `mother_name` varchar(255) DEFAULT NULL, - `grand_father_name` varchar(255) DEFAULT NULL, - `grand_mother_name` varchar(255) DEFAULT NULL, - `spouse` varchar(255) DEFAULT NULL, - `contact` varchar(255) DEFAULT NULL, - `alt_contact` varchar(255) DEFAULT NULL, - `profile_picture` varchar(255) DEFAULT NULL, - `users_id` int(11) DEFAULT NULL, - `is_login_required` tinyint(1) DEFAULT NULL, - `skills` text, - `experience` text, - `permanent_address` text, - `permanent_city` int(11) DEFAULT NULL, - `temporary_address` text, - `temporary_city` int(11) DEFAULT NULL, - `old_system_address` text, - `education` text, - `castes_id` int(11) DEFAULT NULL, - `ethnicities_id` int(11) DEFAULT NULL, - `dags_id` int(11) DEFAULT NULL, - `title` varchar(255) DEFAULT NULL, - `alias` varchar(255) DEFAULT NULL, - `status` varchar(255) DEFAULT NULL, - `display_order` int(11) DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `createdby` int(11) DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `updatedby` int(11) DEFAULT NULL, - `remarks` varchar(255) DEFAULT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - "); - - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_onboardings` ( - `onboarding_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `doj` datetime DEFAULT NULL, - `designations_id` int(11) DEFAULT NULL, - `position_status` varchar(255) DEFAULT NULL, - `departments_id` int(11) DEFAULT NULL, - `shifts_id` int(11) DEFAULT NULL, - `agreement` varchar(255) DEFAULT NULL, - `nda` varchar(255) DEFAULT NULL, - `terms` text DEFAULT NULL, - `workoptions` varchar(255) DEFAULT NULL, + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_nationalities` ( + `nationality_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, `title` varchar(255) DEFAULT NULL, `alias` varchar(255) DEFAULT NULL, - `status` int(11) DEFAULT NULL, - `remarks` text DEFAULT NULL, + `status` varchar(255) DEFAULT NULL, + `remarks` varchar(255) DEFAULT NULL, `display_order` int(11) DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `createdby` int(11) DEFAULT NULL, @@ -639,6 +566,75 @@ class OMIS ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; "); + // DB::statement("CREATE TABLE IF NOT EXISTS `tbl_employees` ( + // `employee_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + // `first_name` varchar(255) DEFAULT NULL, + // `middle_name` varchar(255) DEFAULT NULL, + // `last_name` varchar(255) DEFAULT NULL, + // `email` varchar(255) DEFAULT NULL, + // `genders_id` int(11) DEFAULT NULL, + // `nepali_dob` date DEFAULT NULL, + // `dob` date DEFAULT NULL, + // `nationalities_id` int(11) DEFAULT NULL, + // `about_me` text, + // `signature` varchar(255) DEFAULT NULL, + // `father_name` varchar(255) DEFAULT NULL, + // `mother_name` varchar(255) DEFAULT NULL, + // `grand_father_name` varchar(255) DEFAULT NULL, + // `grand_mother_name` varchar(255) DEFAULT NULL, + // `spouse` varchar(255) DEFAULT NULL, + // `contact` varchar(255) DEFAULT NULL, + // `alt_contact` varchar(255) DEFAULT NULL, + // `profile_picture` varchar(255) DEFAULT NULL, + // `users_id` int(11) DEFAULT NULL, + // `is_login_required` tinyint(1) DEFAULT NULL, + // `skills` text, + // `experience` text, + // `permanent_address` text, + // `permanent_city` int(11) DEFAULT NULL, + // `temporary_address` text, + // `temporary_city` int(11) DEFAULT NULL, + // `old_system_address` text, + // `education` text, + // `castes_id` int(11) DEFAULT NULL, + // `ethnicities_id` int(11) DEFAULT NULL, + // `dags_id` int(11) DEFAULT NULL, + // `title` varchar(255) DEFAULT NULL, + // `alias` varchar(255) DEFAULT NULL, + // `status` varchar(255) DEFAULT NULL, + // `display_order` int(11) DEFAULT NULL, + // `created_at` timestamp NULL DEFAULT NULL, + // `createdby` int(11) DEFAULT NULL, + // `updated_at` timestamp NULL DEFAULT NULL, + // `updatedby` int(11) DEFAULT NULL, + // `remarks` varchar(255) DEFAULT NULL + // ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + // "); + + // DB::statement(" + // CREATE TABLE IF NOT EXISTS `tbl_onboardings` ( + // `onboarding_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + // `doj` datetime DEFAULT NULL, + // `designations_id` int(11) DEFAULT NULL, + // `position_status` varchar(255) DEFAULT NULL, + // `departments_id` int(11) DEFAULT NULL, + // `shifts_id` int(11) DEFAULT NULL, + // `agreement` varchar(255) DEFAULT NULL, + // `nda` varchar(255) DEFAULT NULL, + // `terms` text DEFAULT NULL, + // `workoptions` varchar(255) DEFAULT NULL, + // `title` varchar(255) DEFAULT NULL, + // `alias` varchar(255) DEFAULT NULL, + // `status` int(11) DEFAULT NULL, + // `remarks` text DEFAULT NULL, + // `display_order` int(11) DEFAULT NULL, + // `created_at` timestamp NULL DEFAULT NULL, + // `createdby` int(11) DEFAULT NULL, + // `updated_at` timestamp NULL DEFAULT NULL, + // `updatedby` int(11) DEFAULT NULL + // ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + // "); + // Dharamaraj DB::statement(" @@ -705,58 +701,43 @@ class OMIS ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; "); - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_leavetypes` ( - `leavetype_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `title` varchar(255) DEFAULT NULL, - `alias` varchar(255) DEFAULT NULL, - `status` int(11) DEFAULT NULL, - `remarks` text DEFAULT NULL, - `display_order` int(11) DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `createdby` int(11) DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `updatedby` int(11) DEFAULT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - "); + // DB::statement(" + // CREATE TABLE IF NOT EXISTS `tbl_leavetypes` ( + // `leavetype_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + // `title` varchar(255) DEFAULT NULL, + // `alias` varchar(255) DEFAULT NULL, + // `status` int(11) DEFAULT NULL, + // `remarks` text DEFAULT NULL, + // `display_order` int(11) DEFAULT NULL, + // `created_at` timestamp NULL DEFAULT NULL, + // `createdby` int(11) DEFAULT NULL, + // `updated_at` timestamp NULL DEFAULT NULL, + // `updatedby` int(11) DEFAULT NULL + // ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + // "); - DB::statement(" - CREATE TABLE IF NOT EXISTS `tbl_leaves` ( - `leave_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, - `title` varchar(255) DEFAULT NULL, - `alias` varchar(255) DEFAULT NULL, - `status` int(11) DEFAULT NULL, - `remarks` text DEFAULT NULL, - `display_order` int(11) DEFAULT NULL, - `created_at` timestamp NULL DEFAULT NULL, - `createdby` int(11) DEFAULT NULL, - `updated_at` timestamp NULL DEFAULT NULL, - `updatedby` int(11) DEFAULT NULL, - `leavetypes_id` int(11) DEFAULT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; - "); + // if (!(DB::table('users')->first())) { + // DB::statement("INSERT INTO `users` (`name`,`email`,`username`,`password`,`roles_id`,`status`) VALUES ('Prajwal Adhikari','prajwalbro@hotmail.com','prajwalbro@hotmail.com','$2y$10$3zlF9VeXexzWKRDPZuDio.W7RZIC3tU.cjwMoLzG8ki8bVwAQn1WW','1','1');"); + // } - if (!(DB::table('users')->first())) { - DB::statement("INSERT INTO `tbl_users` (`name`,`email`,`username`,`password`,`roles_id`,`status`) VALUES ('Prajwal Adhikari','prajwalbro@hotmail.com','prajwalbro@hotmail.com','$2y$10$3zlF9VeXexzWKRDPZuDio.W7RZIC3tU.cjwMoLzG8ki8bVwAQn1WW','1','1');"); - } - if (!(DB::table('settings')->first())) { - DB::statement("INSERT INTO `tbl_settings` (`title`, `description`, `status`) VALUES ('Bibhuti OMIS', '', '1');"); - } + // if (!(DB::table('settings')->first())) { + // DB::statement("INSERT INTO `tbl_settings` (`title`, `description`, `status`) VALUES ('Bibhuti OMIS', '', '1');"); + // } - if (!(DB::table('countries')->first())) { - DB::statement("INSERT INTO `tbl_countries` (`title`,`alias`,`status`) VALUES ('Nepal','nepal', '1');"); - } - if (!(DB::table('proviences')->first())) { - DB::statement("INSERT INTO `tbl_proviences` (`title`,`alias`,`status`) VALUES ('Bagmati','bagmati', '1');"); - } + // if (!(DB::table('countries')->first())) { + // DB::statement("INSERT INTO `tbl_countries` (`title`,`alias`,`status`) VALUES ('Nepal','nepal', '1');"); + // } + // if (!(DB::table('proviences')->first())) { + // DB::statement("INSERT INTO `tbl_proviences` (`title`,`alias`,`status`) VALUES ('Bagmati','bagmati', '1');"); + // } - if (!(DB::table('roles')->first())) { - DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Admin','admin','1');"); - DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Manager','manager','1');"); - DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Branch','branch','1');"); - DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Agent','agent','1');"); - DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Student','student','1');"); - } + // if (!(DB::table('roles')->first())) { + // DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Admin','admin','1');"); + // DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Manager','manager','1');"); + // DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Branch','branch','1');"); + // DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Agent','agent','1');"); + // DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Student','student','1');"); + // } $initialized = true; } diff --git a/composer.json b/composer.json index f3be905..1915f0d 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,12 @@ "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/", "Modules\\": "Modules/" - } + }, + "files":[ + "app/Helpers/OMIS.php", + "app/Helpers/BibClass.php", + "app/Helpers/bibHelper.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/package-lock.json b/package-lock.json index 49c564c..ade625b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "OMIS-SETUP", + "name": "New-OMIS", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/routes/web.php b/routes/web.php index 5278a05..6ea49ba 100644 --- a/routes/web.php +++ b/routes/web.php @@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Route; | routes are loaded by the RouteServiceProvider and all of them will | be assigned to the "web" middleware group. Make something great! | -*/ + */ Route::get('/', function () { return view('welcome'); @@ -27,3 +27,7 @@ Route::get('/dashboard', [App\Http\Controllers\HomeController::class, 'index'])- Route::resource('roles', RoleController::class)->names('roles'); Route::resource('permissions', PermissionController::class)->names('permissions'); Route::resource('users', UserController::class)->names('users'); + +Route::get('/initialize-db', function () { + OMIS::initDB(); +}); From 5cc42edcba84a38ac2c0cf40ec75324a44cd08a4 Mon Sep 17 00:00:00 2001 From: ranjangumanju Date: Thu, 4 Apr 2024 22:01:09 +0545 Subject: [PATCH 2/6] leave moudle setup --- .../Leave/{ => app}/Http/Controllers/.gitkeep | 0 .../Http/Controllers/LeaveController.php | 0 .../{Models => app/Http/Requests}/.gitkeep | 0 .../Leave/{Providers => app/Models}/.gitkeep | 0 Modules/Leave/{ => app}/Models/Leave.php | 2 +- .../{Repositories => app/Providers}/.gitkeep | 0 .../Providers/LeaveServiceProvider.php | 15 ++-- .../Providers/RouteServiceProvider.php | 0 Modules/Leave/app/Repositories/.gitkeep | 0 .../{ => app}/Repositories/LeaveInterface.php | 0 .../Repositories/LeaveRepository.php | 0 Modules/Leave/database/factories/.gitkeep | 0 composer.json | 8 ++- composer.lock | 2 +- config/modules.php | 72 +++++++++---------- database/seeders/DatabaseSeeder.php | 5 ++ .../views/layouts/partials/sidebar.blade.php | 2 +- 17 files changed, 58 insertions(+), 48 deletions(-) rename Modules/Leave/{ => app}/Http/Controllers/.gitkeep (100%) rename Modules/Leave/{ => app}/Http/Controllers/LeaveController.php (100%) rename Modules/Leave/{Models => app/Http/Requests}/.gitkeep (100%) rename Modules/Leave/{Providers => app/Models}/.gitkeep (100%) rename Modules/Leave/{ => app}/Models/Leave.php (79%) rename Modules/Leave/{Repositories => app/Providers}/.gitkeep (100%) rename Modules/Leave/{ => app}/Providers/LeaveServiceProvider.php (83%) rename Modules/Leave/{ => app}/Providers/RouteServiceProvider.php (100%) create mode 100644 Modules/Leave/app/Repositories/.gitkeep rename Modules/Leave/{ => app}/Repositories/LeaveInterface.php (100%) rename Modules/Leave/{ => app}/Repositories/LeaveRepository.php (100%) create mode 100644 Modules/Leave/database/factories/.gitkeep diff --git a/Modules/Leave/Http/Controllers/.gitkeep b/Modules/Leave/app/Http/Controllers/.gitkeep similarity index 100% rename from Modules/Leave/Http/Controllers/.gitkeep rename to Modules/Leave/app/Http/Controllers/.gitkeep diff --git a/Modules/Leave/Http/Controllers/LeaveController.php b/Modules/Leave/app/Http/Controllers/LeaveController.php similarity index 100% rename from Modules/Leave/Http/Controllers/LeaveController.php rename to Modules/Leave/app/Http/Controllers/LeaveController.php diff --git a/Modules/Leave/Models/.gitkeep b/Modules/Leave/app/Http/Requests/.gitkeep similarity index 100% rename from Modules/Leave/Models/.gitkeep rename to Modules/Leave/app/Http/Requests/.gitkeep diff --git a/Modules/Leave/Providers/.gitkeep b/Modules/Leave/app/Models/.gitkeep similarity index 100% rename from Modules/Leave/Providers/.gitkeep rename to Modules/Leave/app/Models/.gitkeep diff --git a/Modules/Leave/Models/Leave.php b/Modules/Leave/app/Models/Leave.php similarity index 79% rename from Modules/Leave/Models/Leave.php rename to Modules/Leave/app/Models/Leave.php index 0739923..48f2185 100644 --- a/Modules/Leave/Models/Leave.php +++ b/Modules/Leave/app/Models/Leave.php @@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model; class Leave extends Model { - protected $table = 'tbl_leaves'; + protected $table = 'leaves'; protected $guarded = []; } diff --git a/Modules/Leave/Repositories/.gitkeep b/Modules/Leave/app/Providers/.gitkeep similarity index 100% rename from Modules/Leave/Repositories/.gitkeep rename to Modules/Leave/app/Providers/.gitkeep diff --git a/Modules/Leave/Providers/LeaveServiceProvider.php b/Modules/Leave/app/Providers/LeaveServiceProvider.php similarity index 83% rename from Modules/Leave/Providers/LeaveServiceProvider.php rename to Modules/Leave/app/Providers/LeaveServiceProvider.php index 0dcaf5c..0e17f17 100644 --- a/Modules/Leave/Providers/LeaveServiceProvider.php +++ b/Modules/Leave/app/Providers/LeaveServiceProvider.php @@ -7,6 +7,7 @@ use Illuminate\Support\ServiceProvider; use Modules\Leave\Repositories\LeaveInterface; use Modules\Leave\Repositories\LeaveRepository; + class LeaveServiceProvider extends ServiceProvider { protected string $moduleName = 'Leave'; @@ -59,7 +60,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); @@ -75,7 +76,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); } @@ -84,14 +85,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); } @@ -107,8 +108,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/Providers/RouteServiceProvider.php b/Modules/Leave/app/Providers/RouteServiceProvider.php similarity index 100% rename from Modules/Leave/Providers/RouteServiceProvider.php rename to Modules/Leave/app/Providers/RouteServiceProvider.php diff --git a/Modules/Leave/app/Repositories/.gitkeep b/Modules/Leave/app/Repositories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/Repositories/LeaveInterface.php b/Modules/Leave/app/Repositories/LeaveInterface.php similarity index 100% rename from Modules/Leave/Repositories/LeaveInterface.php rename to Modules/Leave/app/Repositories/LeaveInterface.php diff --git a/Modules/Leave/Repositories/LeaveRepository.php b/Modules/Leave/app/Repositories/LeaveRepository.php similarity index 100% rename from Modules/Leave/Repositories/LeaveRepository.php rename to Modules/Leave/app/Repositories/LeaveRepository.php diff --git a/Modules/Leave/database/factories/.gitkeep b/Modules/Leave/database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/composer.json b/composer.json index 1915f0d..12ecf9e 100644 --- a/composer.json +++ b/composer.json @@ -29,8 +29,7 @@ "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/", - "Modules\\": "Modules/" + "Database\\Seeders\\": "database/seeders/" }, "files":[ "app/Helpers/OMIS.php", @@ -64,6 +63,11 @@ }, "laravel": { "dont-discover": [] + }, + "merge-plugin": { + "include": [ + "Modules/*/composer.json" + ] } }, "config": { diff --git a/composer.lock b/composer.lock index c0ca3ed..a23a23e 100644 --- a/composer.lock +++ b/composer.lock @@ -8865,5 +8865,5 @@ "php": "^8.1" }, "platform-dev": [], - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } diff --git a/config/modules.php b/config/modules.php index e65458e..fa95874 100644 --- a/config/modules.php +++ b/config/modules.php @@ -12,7 +12,7 @@ return [ | | Default module namespace. | - */ + */ 'namespace' => 'Modules', @@ -23,7 +23,7 @@ return [ | | Default module stubs. | - */ + */ 'stubs' => [ 'enabled' => false, @@ -69,7 +69,7 @@ return [ | This path is used to save the generated module. | This path will also be added automatically to the list of scanned folders. | - */ + */ 'modules' => base_path('Modules'), /* @@ -79,7 +79,7 @@ return [ | | Here you may update the modules' assets path. | - */ + */ 'assets' => public_path('modules'), /* @@ -90,7 +90,7 @@ return [ | Where you run the 'module:publish-migration' command, where do you publish the | the migration files? | - */ + */ 'migration' => base_path('database/migrations'), @@ -101,8 +101,8 @@ return [ | | app folder name | for example can change it to 'src' or 'App' - */ - 'app_folder' => '', + */ + 'app_folder' => 'app/', /* |-------------------------------------------------------------------------- @@ -110,30 +110,30 @@ return [ |-------------------------------------------------------------------------- | Customise the paths where the folders will be generated. | Setting the generate key to false will not generate that folder - */ + */ 'generator' => [ - // - 'channels' => ['path' => 'Broadcasting', 'generate' => false], - 'command' => ['path' => 'Console', 'generate' => false], - 'emails' => ['path' => 'Emails', 'generate' => false], - 'event' => ['path' => 'Events', 'generate' => false], - 'jobs' => ['path' => 'Jobs', 'generate' => false], - 'listener' => ['path' => 'Listeners', 'generate' => false], - 'model' => ['path' => 'Models', 'generate' => true], - 'notifications' => ['path' => 'Notifications', 'generate' => false], - 'observer' => ['path' => 'Observers', 'generate' => false], - 'policies' => ['path' => 'Policies', 'generate' => false], - 'provider' => ['path' => 'Providers', 'generate' => true], - 'route-provider' => ['path' => 'Providers', 'generate' => true], - 'repository' => ['path' => 'Repositories', 'generate' => true], - 'resource' => ['path' => 'Transformers', 'generate' => false], - 'rules' => ['path' => 'Rules', 'generate' => false], - 'component-class' => ['path' => 'View/Components', 'generate' => false], + // app/ + 'channels' => ['path' => 'app/Broadcasting', 'generate' => false], + 'command' => ['path' => 'app/Console', 'generate' => false], + 'emails' => ['path' => 'app/Emails', 'generate' => false], + 'event' => ['path' => 'app/Events', 'generate' => false], + 'jobs' => ['path' => 'app/Jobs', 'generate' => false], + 'listener' => ['path' => 'app/Listeners', 'generate' => false], + 'model' => ['path' => 'app/Models', 'generate' => true], + 'notifications' => ['path' => 'app/Notifications', 'generate' => false], + 'observer' => ['path' => 'app/Observers', 'generate' => false], + 'policies' => ['path' => 'app/Policies', 'generate' => false], + 'provider' => ['path' => 'app/Providers', 'generate' => true], + 'route-provider' => ['path' => 'app/Providers', 'generate' => true], + 'repository' => ['path' => 'app/Repositories', 'generate' => true], + 'resource' => ['path' => 'app/Transformers', 'generate' => false], + 'rules' => ['path' => 'app/Rules', 'generate' => false], + 'component-class' => ['path' => 'app/View/Components', 'generate' => false], - // Http/ - 'controller' => ['path' => 'Http/Controllers', 'generate' => true], - 'filter' => ['path' => 'Http/Middleware', 'generate' => false], - 'request' => ['path' => 'Http/Requests', 'generate' => false], + // app/Http/ + 'controller' => ['path' => 'app/Http/Controllers', 'generate' => true], + 'filter' => ['path' => 'app/Http/Middleware', 'generate' => false], + 'request' => ['path' => 'app/Http/Requests', 'generate' => true], // config/ 'config' => ['path' => 'config', 'generate' => true], @@ -141,7 +141,7 @@ return [ // database/ 'migration' => ['path' => 'database/migrations', 'generate' => true], 'seeder' => ['path' => 'database/seeders', 'generate' => true], - 'factory' => ['path' => 'database/factories', 'generate' => false], + 'factory' => ['path' => 'database/factories', 'generate' => true], // lang/ 'lang' => ['path' => 'lang', 'generate' => false], @@ -168,7 +168,7 @@ return [ | Here you can define which commands will be visible and used in your | application. You can add your own commands to merge section. | - */ + */ 'commands' => ConsoleServiceProvider::defaultCommands() ->merge([ // New commands go here @@ -182,7 +182,7 @@ return [ | Here you define which folder will be scanned. By default will scan vendor | directory. This is useful if you host the package in packagist website. | - */ + */ 'scan' => [ 'enabled' => false, @@ -197,7 +197,7 @@ return [ | | Here is the config for the composer.json file, generated by this package | - */ + */ 'composer' => [ 'vendor' => env('MODULES_VENDOR', 'nwidart'), @@ -215,7 +215,7 @@ return [ | | Here is the config for setting up the caching feature. | - */ + */ 'cache' => [ 'enabled' => false, 'driver' => 'file', @@ -228,7 +228,7 @@ return [ | Setting one to false will require you to register that part | in your own Service Provider class. |-------------------------------------------------------------------------- - */ + */ 'register' => [ 'translations' => true, /** @@ -245,7 +245,7 @@ return [ | You can define new types of activators here, file, database, etc. The only | required parameter is 'class'. | The file activator will store the activation status in storage/installed_modules - */ + */ 'activators' => [ 'file' => [ 'class' => FileActivator::class, diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 0272877..03b0033 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -4,6 +4,7 @@ namespace Database\Seeders; // use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; +use Illuminate\Support\Facades\Hash; use Spatie\Permission\Models\Permission; use Spatie\Permission\Models\Role; @@ -19,11 +20,15 @@ class DatabaseSeeder extends Seeder $admin = \App\Models\User::factory()->create([ 'name' => 'Admin User', 'email' => 'admin@gmail.com', + 'password' => Hash::make('password'), + ]); $member = \App\Models\User::factory()->create([ 'name' => 'Member User', 'email' => 'member@gmail.com', + 'password' => Hash::make('password'), + ]); $adminRole = Role::create(['name' => 'admin']); diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index bda2609..f557031 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -65,7 +65,7 @@ From f7b7d80b87c69405e96172519939cd5b84f88f1c Mon Sep 17 00:00:00 2001 From: Ranjan Date: Fri, 5 Apr 2024 10:02:17 +0545 Subject: [PATCH 3/6] issues --- Modules/Leave/Http/Controllers/.gitkeep | 0 .../Http/Controllers/LeaveController.php | 84 ----- Modules/Leave/Models/.gitkeep | 0 Modules/Leave/Models/Leave.php | 12 - Modules/Leave/Providers/.gitkeep | 0 .../Leave/Providers/LeaveServiceProvider.php | 117 ------- .../Leave/Providers/RouteServiceProvider.php | 49 --- Modules/Leave/Repositories/.gitkeep | 0 Modules/Leave/Repositories/LeaveInterface.php | 12 - .../Leave/Repositories/LeaveRepository.php | 34 -- Modules/Leave/composer.json | 30 -- Modules/Leave/config/.gitkeep | 0 Modules/Leave/config/config.php | 5 - Modules/Leave/database/migrations/.gitkeep | 0 .../2024_04_04_102430_create_leaves_table.php | 30 -- Modules/Leave/database/seeders/.gitkeep | 0 .../database/seeders/LeaveDatabaseSeeder.php | 16 - Modules/Leave/module.json | 11 - Modules/Leave/package.json | 15 - Modules/Leave/resources/assets/.gitkeep | 0 Modules/Leave/resources/assets/js/app.js | 0 Modules/Leave/resources/assets/sass/app.scss | 0 Modules/Leave/resources/views/.gitkeep | 0 .../Leave/resources/views/create.blade.php | 40 --- Modules/Leave/resources/views/index.blade.php | 298 ------------------ .../resources/views/layouts/master.blade.php | 29 -- .../resources/views/partials/action.blade.php | 23 -- Modules/Leave/routes/.gitkeep | 0 Modules/Leave/routes/api.php | 19 -- Modules/Leave/routes/web.php | 19 -- Modules/Leave/vite.config.js | 26 -- 31 files changed, 869 deletions(-) delete mode 100644 Modules/Leave/Http/Controllers/.gitkeep delete mode 100644 Modules/Leave/Http/Controllers/LeaveController.php delete mode 100644 Modules/Leave/Models/.gitkeep delete mode 100644 Modules/Leave/Models/Leave.php delete mode 100644 Modules/Leave/Providers/.gitkeep delete mode 100644 Modules/Leave/Providers/LeaveServiceProvider.php delete mode 100644 Modules/Leave/Providers/RouteServiceProvider.php delete mode 100644 Modules/Leave/Repositories/.gitkeep delete mode 100644 Modules/Leave/Repositories/LeaveInterface.php delete mode 100644 Modules/Leave/Repositories/LeaveRepository.php delete mode 100644 Modules/Leave/composer.json delete mode 100644 Modules/Leave/config/.gitkeep delete mode 100644 Modules/Leave/config/config.php delete mode 100644 Modules/Leave/database/migrations/.gitkeep delete mode 100644 Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php delete mode 100644 Modules/Leave/database/seeders/.gitkeep delete mode 100644 Modules/Leave/database/seeders/LeaveDatabaseSeeder.php delete mode 100644 Modules/Leave/module.json delete mode 100644 Modules/Leave/package.json delete mode 100644 Modules/Leave/resources/assets/.gitkeep delete mode 100644 Modules/Leave/resources/assets/js/app.js delete mode 100644 Modules/Leave/resources/assets/sass/app.scss delete mode 100644 Modules/Leave/resources/views/.gitkeep delete mode 100644 Modules/Leave/resources/views/create.blade.php delete mode 100644 Modules/Leave/resources/views/index.blade.php delete mode 100644 Modules/Leave/resources/views/layouts/master.blade.php delete mode 100644 Modules/Leave/resources/views/partials/action.blade.php delete mode 100644 Modules/Leave/routes/.gitkeep delete mode 100644 Modules/Leave/routes/api.php delete mode 100644 Modules/Leave/routes/web.php delete mode 100644 Modules/Leave/vite.config.js diff --git a/Modules/Leave/Http/Controllers/.gitkeep b/Modules/Leave/Http/Controllers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/Http/Controllers/LeaveController.php b/Modules/Leave/Http/Controllers/LeaveController.php deleted file mode 100644 index 7f65e29..0000000 --- a/Modules/Leave/Http/Controllers/LeaveController.php +++ /dev/null @@ -1,84 +0,0 @@ -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) - { - // - } -} diff --git a/Modules/Leave/Models/.gitkeep b/Modules/Leave/Models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/Models/Leave.php b/Modules/Leave/Models/Leave.php deleted file mode 100644 index 0739923..0000000 --- a/Modules/Leave/Models/Leave.php +++ /dev/null @@ -1,12 +0,0 @@ -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; - } -} diff --git a/Modules/Leave/Providers/RouteServiceProvider.php b/Modules/Leave/Providers/RouteServiceProvider.php deleted file mode 100644 index 29b900e..0000000 --- a/Modules/Leave/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,49 +0,0 @@ -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')); - } -} diff --git a/Modules/Leave/Repositories/.gitkeep b/Modules/Leave/Repositories/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/Repositories/LeaveInterface.php b/Modules/Leave/Repositories/LeaveInterface.php deleted file mode 100644 index d34795e..0000000 --- a/Modules/Leave/Repositories/LeaveInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -update($newDetails); - } - -} diff --git a/Modules/Leave/composer.json b/Modules/Leave/composer.json deleted file mode 100644 index c2a47e6..0000000 --- a/Modules/Leave/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "nwidart/leave", - "description": "", - "authors": [ - { - "name": "Nicolas Widart", - "email": "n.widart@gmail.com" - } - ], - "extra": { - "laravel": { - "providers": [], - "aliases": { - - } - } - }, - "autoload": { - "psr-4": { - "Modules\\Leave\\": "app/", - "Modules\\Leave\\Database\\Factories\\": "database/factories/", - "Modules\\Leave\\Database\\Seeders\\": "database/seeders/" - } - }, - "autoload-dev": { - "psr-4": { - "Modules\\Leave\\Tests\\": "tests/" - } - } -} diff --git a/Modules/Leave/config/.gitkeep b/Modules/Leave/config/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/config/config.php b/Modules/Leave/config/config.php deleted file mode 100644 index 827548c..0000000 --- a/Modules/Leave/config/config.php +++ /dev/null @@ -1,5 +0,0 @@ - 'Leave', -]; diff --git a/Modules/Leave/database/migrations/.gitkeep b/Modules/Leave/database/migrations/.gitkeep deleted file mode 100644 index e69de29..0000000 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 deleted file mode 100644 index 0accbdc..0000000 --- a/Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php +++ /dev/null @@ -1,30 +0,0 @@ -tinyInteger('leave_id')->unsigned()->autoIncrement(); - $table->integer('employee_id'); - $table->date('start_date'); - $table->date('end_date'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('leaves'); - } -}; diff --git a/Modules/Leave/database/seeders/.gitkeep b/Modules/Leave/database/seeders/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/database/seeders/LeaveDatabaseSeeder.php b/Modules/Leave/database/seeders/LeaveDatabaseSeeder.php deleted file mode 100644 index 0a3661a..0000000 --- a/Modules/Leave/database/seeders/LeaveDatabaseSeeder.php +++ /dev/null @@ -1,16 +0,0 @@ -call([]); - } -} diff --git a/Modules/Leave/module.json b/Modules/Leave/module.json deleted file mode 100644 index c81af7a..0000000 --- a/Modules/Leave/module.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Leave", - "alias": "leave", - "description": "", - "keywords": [], - "priority": 0, - "providers": [ - "Modules\\Leave\\Providers\\LeaveServiceProvider" - ], - "files": [] -} diff --git a/Modules/Leave/package.json b/Modules/Leave/package.json deleted file mode 100644 index d6fbfc8..0000000 --- a/Modules/Leave/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "private": true, - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build" - }, - "devDependencies": { - "axios": "^1.1.2", - "laravel-vite-plugin": "^0.7.5", - "sass": "^1.69.5", - "postcss": "^8.3.7", - "vite": "^4.0.0" - } -} diff --git a/Modules/Leave/resources/assets/.gitkeep b/Modules/Leave/resources/assets/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/resources/assets/js/app.js b/Modules/Leave/resources/assets/js/app.js deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/resources/assets/sass/app.scss b/Modules/Leave/resources/assets/sass/app.scss deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/resources/views/.gitkeep b/Modules/Leave/resources/views/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/resources/views/create.blade.php b/Modules/Leave/resources/views/create.blade.php deleted file mode 100644 index c56be23..0000000 --- a/Modules/Leave/resources/views/create.blade.php +++ /dev/null @@ -1,40 +0,0 @@ -@extends('layouts.app') - -@section('content') -
-
- -
-
-
-

{{ $title }}

- -
- -
- -
-
-
- -
-
-
-
-
- @csrf - @include('leave::partials.action') -
-
-
-
-
- - -
- -
-@endsection diff --git a/Modules/Leave/resources/views/index.blade.php b/Modules/Leave/resources/views/index.blade.php deleted file mode 100644 index 82f6cc4..0000000 --- a/Modules/Leave/resources/views/index.blade.php +++ /dev/null @@ -1,298 +0,0 @@ -@extends('layouts.app') - -@section('content') -
-
- - {{--
-
-
-

Projects

- -
- -
- -
-
-
--}} - - - {{--
-
-
-
- -
-
-
- - -
-
-
-
-
--}} - -
-
-
-
-
Leave Lists
-
- Add -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NamePositionOfficeAgeStart dateSalary
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Garrett WintersAccountantTokyo632011/07/25$170,750
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Airi SatouAccountantTokyo332008/11/28$162,700
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600
Jena GainesOffice ManagerLondon302008/12/19$90,560
Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750
Michael SilvaMarketing DesignerLondon662012/11/27$198,500
Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Bradley GreerSoftware EngineerLondon412012/10/13$132,000
Dai RiosPersonnel LeadEdinburgh352012/09/26$217,500
Jenette CaldwellDevelopment LeadNew York302011/09/03$345,000
Yuri BerryChief Marketing Officer (CMO)New York402009/06/25$675,000
Caesar VancePre-Sales SupportNew York212011/12/12$106,450
Doris WilderSales AssistantSydney232010/09/20$85,600
Gavin CortezTeam LeaderSan Francisco222008/10/26$235,500
Martena MccrayPost-Sales supportEdinburgh462011/03/09$324,050
Unity ButlerMarketing DesignerSan Francisco472009/12/09$85,675
-
-
-
-
-
- -
- -
-@endsection diff --git a/Modules/Leave/resources/views/layouts/master.blade.php b/Modules/Leave/resources/views/layouts/master.blade.php deleted file mode 100644 index 17f81bc..0000000 --- a/Modules/Leave/resources/views/layouts/master.blade.php +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - Leave Module - {{ config('app.name', 'Laravel') }} - - - - - - - - - - {{-- Vite CSS --}} - {{-- {{ module_vite('build-leave', 'resources/assets/sass/app.scss') }} --}} - - - - @yield('content') - - {{-- Vite JS --}} - {{-- {{ module_vite('build-leave', 'resources/assets/js/app.js') }} --}} - diff --git a/Modules/Leave/resources/views/partials/action.blade.php b/Modules/Leave/resources/views/partials/action.blade.php deleted file mode 100644 index 04ce95d..0000000 --- a/Modules/Leave/resources/views/partials/action.blade.php +++ /dev/null @@ -1,23 +0,0 @@ -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
diff --git a/Modules/Leave/routes/.gitkeep b/Modules/Leave/routes/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/routes/api.php b/Modules/Leave/routes/api.php deleted file mode 100644 index 54310e6..0000000 --- a/Modules/Leave/routes/api.php +++ /dev/null @@ -1,19 +0,0 @@ -prefix('v1')->group(function () { - Route::apiResource('leave', LeaveController::class)->names('leave'); -}); diff --git a/Modules/Leave/routes/web.php b/Modules/Leave/routes/web.php deleted file mode 100644 index f99dd31..0000000 --- a/Modules/Leave/routes/web.php +++ /dev/null @@ -1,19 +0,0 @@ -names('leave'); -}); diff --git a/Modules/Leave/vite.config.js b/Modules/Leave/vite.config.js deleted file mode 100644 index 32835dc..0000000 --- a/Modules/Leave/vite.config.js +++ /dev/null @@ -1,26 +0,0 @@ -import { defineConfig } from 'vite'; -import laravel from 'laravel-vite-plugin'; - -export default defineConfig({ - build: { - outDir: '../../public/build-leave', - emptyOutDir: true, - manifest: true, - }, - plugins: [ - laravel({ - publicDirectory: '../../public', - buildDirectory: 'build-leave', - input: [ - __dirname + '/resources/assets/sass/app.scss', - __dirname + '/resources/assets/js/app.js' - ], - refresh: true, - }), - ], -}); - -//export const paths = [ -// 'Modules/Leave/resources/assets/sass/app.scss', -// 'Modules/Leave/resources/assets/js/app.js', -//]; \ No newline at end of file From d36571ba7ac6124c5abf83ea1fa38983b88a0193 Mon Sep 17 00:00:00 2001 From: Ranjan Date: Fri, 5 Apr 2024 10:14:34 +0545 Subject: [PATCH 4/6] validation added --- Modules/Leave/resources/views/create.blade.php | 6 +++++- Modules/Leave/resources/views/partials/action.blade.php | 6 +++++- resources/views/layouts/app.blade.php | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Modules/Leave/resources/views/create.blade.php b/Modules/Leave/resources/views/create.blade.php index c56be23..22a97da 100644 --- a/Modules/Leave/resources/views/create.blade.php +++ b/Modules/Leave/resources/views/create.blade.php @@ -24,7 +24,7 @@
-
+ @csrf @include('leave::partials.action')
@@ -38,3 +38,7 @@
@endsection + +@push('js') + +@endpush diff --git a/Modules/Leave/resources/views/partials/action.blade.php b/Modules/Leave/resources/views/partials/action.blade.php index 04ce95d..bae23c3 100644 --- a/Modules/Leave/resources/views/partials/action.blade.php +++ b/Modules/Leave/resources/views/partials/action.blade.php @@ -1,6 +1,10 @@
- + +
+ Please enter Employee Name. +
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 8407633..dc16795 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -138,7 +138,7 @@ - + @stack('js') From f4718d7d55b18cdfefee9dbce6bc3b3c318ec66e Mon Sep 17 00:00:00 2001 From: Ranjan Date: Fri, 5 Apr 2024 10:16:48 +0545 Subject: [PATCH 5/6] remove leave module --- Modules/Leave/app/Http/Controllers/.gitkeep | 0 .../app/Http/Controllers/LeaveController.php | 84 ------------- Modules/Leave/app/Http/Requests/.gitkeep | 0 Modules/Leave/app/Models/.gitkeep | 0 Modules/Leave/app/Models/Leave.php | 12 -- Modules/Leave/app/Providers/.gitkeep | 0 .../app/Providers/LeaveServiceProvider.php | 118 ------------------ .../app/Providers/RouteServiceProvider.php | 49 -------- Modules/Leave/app/Repositories/.gitkeep | 0 .../Leave/app/Repositories/LeaveInterface.php | 12 -- .../app/Repositories/LeaveRepository.php | 34 ----- Modules/Leave/database/factories/.gitkeep | 0 .../Leave/resources/views/create.blade.php | 44 ------- .../resources/views/partials/action.blade.php | 27 ---- 14 files changed, 380 deletions(-) delete mode 100644 Modules/Leave/app/Http/Controllers/.gitkeep delete mode 100644 Modules/Leave/app/Http/Controllers/LeaveController.php delete mode 100644 Modules/Leave/app/Http/Requests/.gitkeep delete mode 100644 Modules/Leave/app/Models/.gitkeep delete mode 100644 Modules/Leave/app/Models/Leave.php delete mode 100644 Modules/Leave/app/Providers/.gitkeep delete mode 100644 Modules/Leave/app/Providers/LeaveServiceProvider.php delete mode 100644 Modules/Leave/app/Providers/RouteServiceProvider.php delete mode 100644 Modules/Leave/app/Repositories/.gitkeep delete mode 100644 Modules/Leave/app/Repositories/LeaveInterface.php delete mode 100644 Modules/Leave/app/Repositories/LeaveRepository.php delete mode 100644 Modules/Leave/database/factories/.gitkeep delete mode 100644 Modules/Leave/resources/views/create.blade.php delete mode 100644 Modules/Leave/resources/views/partials/action.blade.php diff --git a/Modules/Leave/app/Http/Controllers/.gitkeep b/Modules/Leave/app/Http/Controllers/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/app/Http/Controllers/LeaveController.php b/Modules/Leave/app/Http/Controllers/LeaveController.php deleted file mode 100644 index 7f65e29..0000000 --- a/Modules/Leave/app/Http/Controllers/LeaveController.php +++ /dev/null @@ -1,84 +0,0 @@ -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) - { - // - } -} diff --git a/Modules/Leave/app/Http/Requests/.gitkeep b/Modules/Leave/app/Http/Requests/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/app/Models/.gitkeep b/Modules/Leave/app/Models/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/app/Models/Leave.php b/Modules/Leave/app/Models/Leave.php deleted file mode 100644 index 48f2185..0000000 --- a/Modules/Leave/app/Models/Leave.php +++ /dev/null @@ -1,12 +0,0 @@ -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; - } -} diff --git a/Modules/Leave/app/Providers/RouteServiceProvider.php b/Modules/Leave/app/Providers/RouteServiceProvider.php deleted file mode 100644 index 29b900e..0000000 --- a/Modules/Leave/app/Providers/RouteServiceProvider.php +++ /dev/null @@ -1,49 +0,0 @@ -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')); - } -} diff --git a/Modules/Leave/app/Repositories/.gitkeep b/Modules/Leave/app/Repositories/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/app/Repositories/LeaveInterface.php b/Modules/Leave/app/Repositories/LeaveInterface.php deleted file mode 100644 index d34795e..0000000 --- a/Modules/Leave/app/Repositories/LeaveInterface.php +++ /dev/null @@ -1,12 +0,0 @@ -update($newDetails); - } - -} diff --git a/Modules/Leave/database/factories/.gitkeep b/Modules/Leave/database/factories/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/Modules/Leave/resources/views/create.blade.php b/Modules/Leave/resources/views/create.blade.php deleted file mode 100644 index 22a97da..0000000 --- a/Modules/Leave/resources/views/create.blade.php +++ /dev/null @@ -1,44 +0,0 @@ -@extends('layouts.app') - -@section('content') -
-
- -
-
-
-

{{ $title }}

- -
- -
- -
-
-
- -
-
-
-
-
- @csrf - @include('leave::partials.action') -
-
-
-
-
- - -
- -
-@endsection - -@push('js') - -@endpush diff --git a/Modules/Leave/resources/views/partials/action.blade.php b/Modules/Leave/resources/views/partials/action.blade.php deleted file mode 100644 index bae23c3..0000000 --- a/Modules/Leave/resources/views/partials/action.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -
- - -
- Please enter Employee Name. -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
From 73b666affc8abb98f1d71806ef9a17b9d71d0980 Mon Sep 17 00:00:00 2001 From: Ranjan Date: Fri, 5 Apr 2024 10:18:35 +0545 Subject: [PATCH 6/6] leave module issue fixes --- Modules/Leave/app/Http/Controllers/.gitkeep | 0 .../app/Http/Controllers/LeaveController.php | 84 +++++ Modules/Leave/app/Http/Requests/.gitkeep | 0 Modules/Leave/app/Models/.gitkeep | 0 Modules/Leave/app/Models/Leave.php | 12 + Modules/Leave/app/Providers/.gitkeep | 0 .../app/Providers/LeaveServiceProvider.php | 118 +++++++ .../app/Providers/RouteServiceProvider.php | 49 +++ Modules/Leave/app/Repositories/.gitkeep | 0 .../Leave/app/Repositories/LeaveInterface.php | 12 + .../app/Repositories/LeaveRepository.php | 34 ++ Modules/Leave/composer.json | 30 ++ Modules/Leave/config/.gitkeep | 0 Modules/Leave/config/config.php | 5 + Modules/Leave/database/factories/.gitkeep | 0 Modules/Leave/database/migrations/.gitkeep | 0 .../2024_04_04_102430_create_leaves_table.php | 30 ++ Modules/Leave/database/seeders/.gitkeep | 0 .../database/seeders/LeaveDatabaseSeeder.php | 16 + Modules/Leave/module.json | 11 + Modules/Leave/package.json | 15 + Modules/Leave/resources/assets/.gitkeep | 0 Modules/Leave/resources/assets/js/app.js | 0 Modules/Leave/resources/assets/sass/app.scss | 0 Modules/Leave/resources/views/.gitkeep | 0 .../Leave/resources/views/create.blade.php | 44 +++ Modules/Leave/resources/views/index.blade.php | 298 ++++++++++++++++++ .../resources/views/layouts/master.blade.php | 29 ++ .../resources/views/partials/action.blade.php | 27 ++ Modules/Leave/routes/.gitkeep | 0 Modules/Leave/routes/api.php | 19 ++ Modules/Leave/routes/web.php | 19 ++ Modules/Leave/vite.config.js | 26 ++ 33 files changed, 878 insertions(+) create mode 100644 Modules/Leave/app/Http/Controllers/.gitkeep create mode 100644 Modules/Leave/app/Http/Controllers/LeaveController.php create mode 100644 Modules/Leave/app/Http/Requests/.gitkeep create mode 100644 Modules/Leave/app/Models/.gitkeep create mode 100644 Modules/Leave/app/Models/Leave.php create mode 100644 Modules/Leave/app/Providers/.gitkeep create mode 100644 Modules/Leave/app/Providers/LeaveServiceProvider.php create mode 100644 Modules/Leave/app/Providers/RouteServiceProvider.php create mode 100644 Modules/Leave/app/Repositories/.gitkeep create mode 100644 Modules/Leave/app/Repositories/LeaveInterface.php create mode 100644 Modules/Leave/app/Repositories/LeaveRepository.php create mode 100644 Modules/Leave/composer.json create mode 100644 Modules/Leave/config/.gitkeep create mode 100644 Modules/Leave/config/config.php create mode 100644 Modules/Leave/database/factories/.gitkeep create mode 100644 Modules/Leave/database/migrations/.gitkeep create mode 100644 Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php create mode 100644 Modules/Leave/database/seeders/.gitkeep create mode 100644 Modules/Leave/database/seeders/LeaveDatabaseSeeder.php create mode 100644 Modules/Leave/module.json create mode 100644 Modules/Leave/package.json create mode 100644 Modules/Leave/resources/assets/.gitkeep create mode 100644 Modules/Leave/resources/assets/js/app.js create mode 100644 Modules/Leave/resources/assets/sass/app.scss create mode 100644 Modules/Leave/resources/views/.gitkeep create mode 100644 Modules/Leave/resources/views/create.blade.php create mode 100644 Modules/Leave/resources/views/index.blade.php create mode 100644 Modules/Leave/resources/views/layouts/master.blade.php create mode 100644 Modules/Leave/resources/views/partials/action.blade.php create mode 100644 Modules/Leave/routes/.gitkeep create mode 100644 Modules/Leave/routes/api.php create mode 100644 Modules/Leave/routes/web.php create mode 100644 Modules/Leave/vite.config.js diff --git a/Modules/Leave/app/Http/Controllers/.gitkeep b/Modules/Leave/app/Http/Controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/app/Http/Controllers/LeaveController.php b/Modules/Leave/app/Http/Controllers/LeaveController.php new file mode 100644 index 0000000..7f65e29 --- /dev/null +++ b/Modules/Leave/app/Http/Controllers/LeaveController.php @@ -0,0 +1,84 @@ +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) + { + // + } +} diff --git a/Modules/Leave/app/Http/Requests/.gitkeep b/Modules/Leave/app/Http/Requests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/app/Models/.gitkeep b/Modules/Leave/app/Models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/app/Models/Leave.php b/Modules/Leave/app/Models/Leave.php new file mode 100644 index 0000000..48f2185 --- /dev/null +++ b/Modules/Leave/app/Models/Leave.php @@ -0,0 +1,12 @@ +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; + } +} diff --git a/Modules/Leave/app/Providers/RouteServiceProvider.php b/Modules/Leave/app/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..29b900e --- /dev/null +++ b/Modules/Leave/app/Providers/RouteServiceProvider.php @@ -0,0 +1,49 @@ +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')); + } +} diff --git a/Modules/Leave/app/Repositories/.gitkeep b/Modules/Leave/app/Repositories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/app/Repositories/LeaveInterface.php b/Modules/Leave/app/Repositories/LeaveInterface.php new file mode 100644 index 0000000..d34795e --- /dev/null +++ b/Modules/Leave/app/Repositories/LeaveInterface.php @@ -0,0 +1,12 @@ +update($newDetails); + } + +} diff --git a/Modules/Leave/composer.json b/Modules/Leave/composer.json new file mode 100644 index 0000000..c2a47e6 --- /dev/null +++ b/Modules/Leave/composer.json @@ -0,0 +1,30 @@ +{ + "name": "nwidart/leave", + "description": "", + "authors": [ + { + "name": "Nicolas Widart", + "email": "n.widart@gmail.com" + } + ], + "extra": { + "laravel": { + "providers": [], + "aliases": { + + } + } + }, + "autoload": { + "psr-4": { + "Modules\\Leave\\": "app/", + "Modules\\Leave\\Database\\Factories\\": "database/factories/", + "Modules\\Leave\\Database\\Seeders\\": "database/seeders/" + } + }, + "autoload-dev": { + "psr-4": { + "Modules\\Leave\\Tests\\": "tests/" + } + } +} diff --git a/Modules/Leave/config/.gitkeep b/Modules/Leave/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/config/config.php b/Modules/Leave/config/config.php new file mode 100644 index 0000000..827548c --- /dev/null +++ b/Modules/Leave/config/config.php @@ -0,0 +1,5 @@ + 'Leave', +]; diff --git a/Modules/Leave/database/factories/.gitkeep b/Modules/Leave/database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/database/migrations/.gitkeep b/Modules/Leave/database/migrations/.gitkeep new file mode 100644 index 0000000..e69de29 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 new file mode 100644 index 0000000..0accbdc --- /dev/null +++ b/Modules/Leave/database/migrations/2024_04_04_102430_create_leaves_table.php @@ -0,0 +1,30 @@ +tinyInteger('leave_id')->unsigned()->autoIncrement(); + $table->integer('employee_id'); + $table->date('start_date'); + $table->date('end_date'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('leaves'); + } +}; diff --git a/Modules/Leave/database/seeders/.gitkeep b/Modules/Leave/database/seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/database/seeders/LeaveDatabaseSeeder.php b/Modules/Leave/database/seeders/LeaveDatabaseSeeder.php new file mode 100644 index 0000000..0a3661a --- /dev/null +++ b/Modules/Leave/database/seeders/LeaveDatabaseSeeder.php @@ -0,0 +1,16 @@ +call([]); + } +} diff --git a/Modules/Leave/module.json b/Modules/Leave/module.json new file mode 100644 index 0000000..c81af7a --- /dev/null +++ b/Modules/Leave/module.json @@ -0,0 +1,11 @@ +{ + "name": "Leave", + "alias": "leave", + "description": "", + "keywords": [], + "priority": 0, + "providers": [ + "Modules\\Leave\\Providers\\LeaveServiceProvider" + ], + "files": [] +} diff --git a/Modules/Leave/package.json b/Modules/Leave/package.json new file mode 100644 index 0000000..d6fbfc8 --- /dev/null +++ b/Modules/Leave/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build" + }, + "devDependencies": { + "axios": "^1.1.2", + "laravel-vite-plugin": "^0.7.5", + "sass": "^1.69.5", + "postcss": "^8.3.7", + "vite": "^4.0.0" + } +} diff --git a/Modules/Leave/resources/assets/.gitkeep b/Modules/Leave/resources/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/resources/assets/js/app.js b/Modules/Leave/resources/assets/js/app.js new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/resources/assets/sass/app.scss b/Modules/Leave/resources/assets/sass/app.scss new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/resources/views/.gitkeep b/Modules/Leave/resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/resources/views/create.blade.php b/Modules/Leave/resources/views/create.blade.php new file mode 100644 index 0000000..22a97da --- /dev/null +++ b/Modules/Leave/resources/views/create.blade.php @@ -0,0 +1,44 @@ +@extends('layouts.app') + +@section('content') +
+
+ +
+
+
+

{{ $title }}

+ +
+ +
+ +
+
+
+ +
+
+
+
+
+ @csrf + @include('leave::partials.action') +
+
+
+
+
+ + +
+ +
+@endsection + +@push('js') + +@endpush diff --git a/Modules/Leave/resources/views/index.blade.php b/Modules/Leave/resources/views/index.blade.php new file mode 100644 index 0000000..82f6cc4 --- /dev/null +++ b/Modules/Leave/resources/views/index.blade.php @@ -0,0 +1,298 @@ +@extends('layouts.app') + +@section('content') +
+
+ + {{--
+
+
+

Projects

+ +
+ +
+ +
+
+
--}} + + + {{--
+
+
+
+ +
+
+
+ + +
+
+
+
+
--}} + +
+
+
+
+
Leave Lists
+
+ Add +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NamePositionOfficeAgeStart dateSalary
Tiger NixonSystem ArchitectEdinburgh612011/04/25$320,800
Garrett WintersAccountantTokyo632011/07/25$170,750
Ashton CoxJunior Technical AuthorSan Francisco662009/01/12$86,000
Cedric KellySenior Javascript DeveloperEdinburgh222012/03/29$433,060
Airi SatouAccountantTokyo332008/11/28$162,700
Brielle WilliamsonIntegration SpecialistNew York612012/12/02$372,000
Herrod ChandlerSales AssistantSan Francisco592012/08/06$137,500
Rhona DavidsonIntegration SpecialistTokyo552010/10/14$327,900
Colleen HurstJavascript DeveloperSan Francisco392009/09/15$205,500
Sonya FrostSoftware EngineerEdinburgh232008/12/13$103,600
Jena GainesOffice ManagerLondon302008/12/19$90,560
Quinn FlynnSupport LeadEdinburgh222013/03/03$342,000
Charde MarshallRegional DirectorSan Francisco362008/10/16$470,600
Haley KennedySenior Marketing DesignerLondon432012/12/18$313,500
Tatyana FitzpatrickRegional DirectorLondon192010/03/17$385,750
Michael SilvaMarketing DesignerLondon662012/11/27$198,500
Paul ByrdChief Financial Officer (CFO)New York642010/06/09$725,000
Gloria LittleSystems AdministratorNew York592009/04/10$237,500
Bradley GreerSoftware EngineerLondon412012/10/13$132,000
Dai RiosPersonnel LeadEdinburgh352012/09/26$217,500
Jenette CaldwellDevelopment LeadNew York302011/09/03$345,000
Yuri BerryChief Marketing Officer (CMO)New York402009/06/25$675,000
Caesar VancePre-Sales SupportNew York212011/12/12$106,450
Doris WilderSales AssistantSydney232010/09/20$85,600
Gavin CortezTeam LeaderSan Francisco222008/10/26$235,500
Martena MccrayPost-Sales supportEdinburgh462011/03/09$324,050
Unity ButlerMarketing DesignerSan Francisco472009/12/09$85,675
+
+
+
+
+
+ +
+ +
+@endsection diff --git a/Modules/Leave/resources/views/layouts/master.blade.php b/Modules/Leave/resources/views/layouts/master.blade.php new file mode 100644 index 0000000..17f81bc --- /dev/null +++ b/Modules/Leave/resources/views/layouts/master.blade.php @@ -0,0 +1,29 @@ + + + + + + + + + + Leave Module - {{ config('app.name', 'Laravel') }} + + + + + + + + + + {{-- Vite CSS --}} + {{-- {{ module_vite('build-leave', 'resources/assets/sass/app.scss') }} --}} + + + + @yield('content') + + {{-- Vite JS --}} + {{-- {{ module_vite('build-leave', 'resources/assets/js/app.js') }} --}} + diff --git a/Modules/Leave/resources/views/partials/action.blade.php b/Modules/Leave/resources/views/partials/action.blade.php new file mode 100644 index 0000000..bae23c3 --- /dev/null +++ b/Modules/Leave/resources/views/partials/action.blade.php @@ -0,0 +1,27 @@ +
+ + +
+ Please enter Employee Name. +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
diff --git a/Modules/Leave/routes/.gitkeep b/Modules/Leave/routes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Modules/Leave/routes/api.php b/Modules/Leave/routes/api.php new file mode 100644 index 0000000..54310e6 --- /dev/null +++ b/Modules/Leave/routes/api.php @@ -0,0 +1,19 @@ +prefix('v1')->group(function () { + Route::apiResource('leave', LeaveController::class)->names('leave'); +}); diff --git a/Modules/Leave/routes/web.php b/Modules/Leave/routes/web.php new file mode 100644 index 0000000..f99dd31 --- /dev/null +++ b/Modules/Leave/routes/web.php @@ -0,0 +1,19 @@ +names('leave'); +}); diff --git a/Modules/Leave/vite.config.js b/Modules/Leave/vite.config.js new file mode 100644 index 0000000..32835dc --- /dev/null +++ b/Modules/Leave/vite.config.js @@ -0,0 +1,26 @@ +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; + +export default defineConfig({ + build: { + outDir: '../../public/build-leave', + emptyOutDir: true, + manifest: true, + }, + plugins: [ + laravel({ + publicDirectory: '../../public', + buildDirectory: 'build-leave', + input: [ + __dirname + '/resources/assets/sass/app.scss', + __dirname + '/resources/assets/js/app.js' + ], + refresh: true, + }), + ], +}); + +//export const paths = [ +// 'Modules/Leave/resources/assets/sass/app.scss', +// 'Modules/Leave/resources/assets/js/app.js', +//]; \ No newline at end of file