diff --git a/Modules/Leave/Models/Leave.php b/Modules/Leave/Models/Leave.php deleted file mode 100644 index 64d02eb..0000000 --- a/Modules/Leave/Models/Leave.php +++ /dev/null @@ -1,22 +0,0 @@ -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/.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/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 @@ +app->bind(LeaveInterface::class, LeaveRepository::class); $this->app->register(RouteServiceProvider::class); } 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 95% rename from Modules/Leave/Repositories/LeaveRepository.php rename to Modules/Leave/app/Repositories/LeaveRepository.php index 62ff34c..abdb3a5 100644 --- a/Modules/Leave/Repositories/LeaveRepository.php +++ b/Modules/Leave/app/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/factories/.gitkeep b/Modules/Leave/database/factories/.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 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..22a97da 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')
@@ -37,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 c33288d..bae23c3 100644 --- a/Modules/Leave/resources/views/partials/action.blade.php +++ b/Modules/Leave/resources/views/partials/action.blade.php @@ -1,22 +1,26 @@
- + +
+ Please enter Employee Name. +
- +
- +
- +
- +
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..12ecf9e 100644 --- a/composer.json +++ b/composer.json @@ -29,9 +29,13 @@ "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", - "Database\\Seeders\\": "database/seeders/", - "Modules\\": "Modules/" - } + "Database\\Seeders\\": "database/seeders/" + }, + "files":[ + "app/Helpers/OMIS.php", + "app/Helpers/BibClass.php", + "app/Helpers/bibHelper.php" + ] }, "autoload-dev": { "psr-4": { @@ -59,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/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/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index 4211643..bcf0a32 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -65,7 +65,7 @@ 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(); +});