├── save() ├── public ├── favicon.ico ├── robots.txt ├── .htaccess └── index.php ├── resources ├── css │ └── app.css ├── views │ └── vendor │ │ ├── l5-swagger │ │ ├── .gitkeep │ │ └── index.blade.php │ │ └── passport │ │ └── authorize.blade.php └── js │ ├── app.js │ └── bootstrap.js ├── database ├── .gitignore ├── seeders │ ├── WorkPositionSeeder.php │ ├── WorkContractTypeSeeder.php │ ├── WorkShiftSeeder.php │ ├── DepartmentSeeder.php │ ├── LeaveRequestSeeder.php │ ├── KanbanColumnsSeeder.php │ ├── DatabaseSeeder.php │ ├── KanbanTagsSeeder.php │ ├── JobOfferSeeder.php │ ├── EmployeeSeeder.php │ ├── CandidateSeeder.php │ ├── UserSeeder.php │ └── KanbanTasksSeeder.php ├── migrations │ ├── 2024_08_15_205453_create_review_reports_table.php │ ├── 2024_08_20_174606_add_employee_id_foreign_key_to_leave_requests_table.php │ ├── 2024_08_29_203642_create_kanban_columns.php │ ├── 2024_08_20_180418_add_employee_id_foreign_key_to_employee_documents_table.php │ ├── 2024_08_20_174940_add_employee_id_foreign_key_to_performance_reviews_table.php │ ├── 2024_08_15_205505_create_departments_table.php │ ├── 2024_09_04_170525_kanban_tags.php │ ├── 2024_08_30_131934_work_positions_table.php │ ├── 2024_08_15_205431_create_employee_documents_table.php │ ├── 2024_08_30_131920_work_contract_type_table.php │ ├── 2016_06_01_000005_create_oauth_personal_access_clients_table.php │ ├── 2024_08_30_131903_work_shifts_table.php │ ├── 2024_09_04_171348_add_display_order_to_kanban_tasks_table.php │ ├── 2024_08_15_205447_create_performance_reviews_table.php │ ├── 2016_06_01_000003_create_oauth_refresh_tokens_table.php │ ├── 2024_08_20_190052_add_user_id_to_employees.php │ ├── 2024_08_30_134744_add_foreign_keys_to_attendance_table.php │ ├── 2024_09_04_170534_kanban_task_tag.php │ ├── 2024_08_20_184942_add_job_offer_id_to_candidates.php │ ├── 2024_08_30_134324_add_foreign_keys_to_job_offers_table.php │ ├── 0001_01_01_000001_create_cache_table.php │ ├── 2016_06_01_000001_create_oauth_auth_codes_table.php │ ├── 2024_08_29_203924_create_kanban_tasks.php │ ├── 2024_08_15_205458_create_leave_requests_table.php │ ├── 2024_09_01_124905_contract_type_id_in_joboffer_table.php │ ├── 2016_06_01_000002_create_oauth_access_tokens_table.php │ ├── 2016_06_01_000004_create_oauth_clients_table.php │ ├── 2024_08_15_205442_create_job_offers_table.php │ ├── 2024_08_29_202341_create_attendance_table.php │ ├── 2024_08_30_134924_add_foreign_keys_to_kanban_tables.php │ ├── 2024_08_15_205424_create_candidates_table.php │ ├── 2024_08_30_132444_add_foreign_keys_to_employee_table.php │ ├── 2024_08_20_173744_add_foreign_keys_to_tables.php │ ├── 2024_08_15_205417_create_employees_table.php │ ├── 0001_01_01_000000_create_users_table.php │ └── 0001_01_01_000002_create_jobs_table.php └── factories │ └── UserFactory.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore ├── framework │ ├── testing │ │ └── .gitignore │ ├── views │ │ └── .gitignore │ ├── cache │ │ ├── data │ │ │ └── .gitignore │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── .gitignore └── api-docs │ └── api-docs.json ├── .rnd ├── routes ├── api │ ├── auth.php │ ├── utils.php │ ├── publicListing.php │ ├── user.php │ ├── JobOffer.php │ ├── candidate.php │ ├── employee.php │ └── structure.php ├── web.php ├── channels.php ├── console.php └── api.php ├── app ├── Http │ ├── Controllers │ │ ├── AbsenceController.php │ │ ├── LeaveRequestController.php │ │ ├── ReviewReportController.php │ │ ├── EmployeeDocumentController.php │ │ ├── PerformanceReviewController.php │ │ ├── Controller.php │ │ ├── TestController.php │ │ ├── Structure │ │ │ ├── PositionController.php │ │ │ └── DepartmentController.php │ │ ├── AuthController.php │ │ ├── UtilsController.php │ │ ├── PublicJobListing │ │ │ └── JobListingController.php │ │ ├── CandidateController.php │ │ ├── JobOfferController.php │ │ ├── UserController.php │ │ └── EmployeeController.php │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── ValidateSignature.php │ │ ├── Authenticate.php │ │ ├── TrustProxies.php │ │ └── RedirectIfAuthenticated.php │ └── Kernel.php ├── Models │ ├── WorkPosition.php │ ├── WorkShift.php │ ├── KanbanTags.php │ ├── WorkContractType.php │ ├── KanbanColumn.php │ ├── ReviewReport.php │ ├── PerformanceReview.php │ ├── LeaveRequest.php │ ├── Attendance.php │ ├── EmployeeDocument.php │ ├── Department.php │ ├── Candidate.php │ ├── JobOffer.php │ ├── KanbanTask.php │ ├── User.php │ └── Employee.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Console │ └── Kernel.php ├── Utils │ └── ApiResponse.php └── Exceptions │ └── Handler.php ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── Feature │ └── ExampleTest.php └── CreatesApplication.php ├── .gitattributes ├── package.json ├── vite.config.js ├── .gitignore ├── .editorconfig ├── config ├── cors.php ├── services.php ├── view.php ├── hashing.php ├── broadcasting.php ├── filesystems.php ├── passport.php ├── sanctum.php ├── cache.php ├── queue.php ├── auth.php ├── mail.php ├── logging.php ├── database.php ├── app.php └── session.php ├── phpunit.xml ├── .env.example ├── artisan ├── composer.json └── README.md /save(): -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /resources/views/vendor/l5-swagger/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /.rnd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShaheenJawadi/pulse-hr-backend/HEAD/.rnd -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /routes/api/auth.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /app/Models/KanbanTags.php: -------------------------------------------------------------------------------- 1 | belongsToMany(KanbanTask::class, 'kanban_task_tag'); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/Models/WorkContractType.php: -------------------------------------------------------------------------------- 1 | group(function () { 11 | 12 | Route::get('/lister', [UtilsController::class, 'kanbanLister']); 13 | Route::post('/update', [UtilsController::class, 'updateKanban']); 14 | 15 | }); -------------------------------------------------------------------------------- /database/seeders/WorkPositionSeeder.php: -------------------------------------------------------------------------------- 1 | 'Software Engineer', 14 | ]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /database/seeders/WorkContractTypeSeeder.php: -------------------------------------------------------------------------------- 1 | 'Full-time', 14 | ]); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /database/seeders/WorkShiftSeeder.php: -------------------------------------------------------------------------------- 1 | 'oiazdoiazd azudioazuio', 14 | 'content' => 'qsdsqsdqs', 15 | ]); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Models/KanbanColumn.php: -------------------------------------------------------------------------------- 1 | hasMany(KanbanTask::class, 'column_id'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | group(function () { 9 | 10 | Route::post('/add', [JobListingController::class, 'apply']); 11 | }); 12 | 13 | 14 | 15 | Route::get('/lister', [JobListingController::class, 'index']); 16 | 17 | 18 | Route::get('/show/{slug}', [JobListingController::class, 'show']); 19 | -------------------------------------------------------------------------------- /routes/api/user.php: -------------------------------------------------------------------------------- 1 | get('/'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 18 | 19 | return $app; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts(): array 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Models/ReviewReport.php: -------------------------------------------------------------------------------- 1 | belongsTo(PerformanceReview::class, 'review_id'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /routes/api/JobOffer.php: -------------------------------------------------------------------------------- 1 | belongsTo(Employee::class, 'employee_id'); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Models/LeaveRequest.php: -------------------------------------------------------------------------------- 1 | belongsTo(Employee::class, 'employee_id'); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Controllers/TestController.php: -------------------------------------------------------------------------------- 1 | email)->first(); 17 | 18 | 19 | 20 | $token = $user->createToken('accessTocken')->accessToken; 21 | return response()->json(['message' => $token]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Models/Attendance.php: -------------------------------------------------------------------------------- 1 | belongsTo(Employee::class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | belongsTo(Employee::class , 'employee_id'); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /database/seeders/DepartmentSeeder.php: -------------------------------------------------------------------------------- 1 | 'Engineering', 14 | 'location' => 'sfax ', 15 | 'manager_id' => null, 16 | ]); 17 | Department::create([ 18 | 'name' => 'Engineering', 19 | 'location' => 'tunis ', 20 | 'manager_id' => null, 21 | ]); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/Models/Department.php: -------------------------------------------------------------------------------- 1 | hasMany(Employee::class, 'department_id'); 18 | } 19 | 20 | public function manager() 21 | { 22 | return $this->belongsTo(Employee::class, 'manager_id'); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /database/seeders/LeaveRequestSeeder.php: -------------------------------------------------------------------------------- 1 | 3, 14 | 'start_date' => now()->addDays(1), 15 | 'end_date' => now()->addDays(5), 16 | 'leave_type' => 'Vacation', 17 | 'comments' => 'Family vacation', 18 | 'status' => 'Approved', 19 | 'manager_comments' => 'Enjoy your vacation!', 20 | ]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /database/seeders/KanbanColumnsSeeder.php: -------------------------------------------------------------------------------- 1 | 'À Faire'], 18 | ['title' => 'En Cours'], 19 | ['title' => 'En Révision'], 20 | ['title' => 'Terminé'], 21 | ]; 22 | 23 | KanbanColumn::insert($columns); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Models/Candidate.php: -------------------------------------------------------------------------------- 1 | belongsTo(JobOffer::class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 16 | } 17 | 18 | /** 19 | * Register the commands for the application. 20 | */ 21 | protected function commands(): void 22 | { 23 | $this->load(__DIR__.'/Commands'); 24 | 25 | require base_path('routes/console.php'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205453_create_review_reports_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->unsignedBigInteger('review_id'); 15 | $table->string('report_path'); 16 | $table->timestamps(); 17 | }); 18 | } 19 | 20 | 21 | 22 | public function down(): void 23 | { 24 | Schema::dropIfExists('review_reports'); 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /database/migrations/2024_08_20_174606_add_employee_id_foreign_key_to_leave_requests_table.php: -------------------------------------------------------------------------------- 1 | foreign('employee_id')->references('id')->on('employees')->onDelete('cascade'); 13 | }); 14 | } 15 | 16 | 17 | public function down() 18 | { 19 | Schema::table('leave_requests', function (Blueprint $table) { 20 | $table->dropForeign(['employee_id']); 21 | }); 22 | } 23 | 24 | }; 25 | -------------------------------------------------------------------------------- /database/migrations/2024_08_29_203642_create_kanban_columns.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('title'); 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('kanban_columns'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/migrations/2024_08_20_180418_add_employee_id_foreign_key_to_employee_documents_table.php: -------------------------------------------------------------------------------- 1 | foreign('employee_id')->references('id')->on('employees')->onDelete('cascade'); 13 | }); 14 | } 15 | 16 | 17 | public function down() 18 | { 19 | Schema::table('employee_documents', function (Blueprint $table) { 20 | $table->dropForeign(['employee_id']); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /database/migrations/2024_08_20_174940_add_employee_id_foreign_key_to_performance_reviews_table.php: -------------------------------------------------------------------------------- 1 | foreign('employee_id')->references('id')->on('employees')->onDelete('cascade'); 13 | }); 14 | } 15 | 16 | 17 | public function down() 18 | { 19 | Schema::table('performance_reviews', function (Blueprint $table) { 20 | $table->dropForeign(['employee_id']); 21 | }); 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call([ 12 | UserSeeder::class, 13 | WorkContractTypeSeeder::class, 14 | WorkPositionSeeder::class, 15 | WorkShiftSeeder::class, 16 | DepartmentSeeder::class, 17 | EmployeeSeeder::class, 18 | JobOfferSeeder::class, 19 | CandidateSeeder::class, 20 | LeaveRequestSeeder::class, 21 | KanbanTagsSeeder::class, 22 | KanbanColumnsSeeder::class, 23 | KanbanTasksSeeder::class, 24 | ]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | json(['error' => 'Unauthorized'], 401); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205505_create_departments_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->string('name'); 15 | $table->string('location')->nullable(); 16 | $table->unsignedBigInteger('manager_id')->nullable(); 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | 22 | 23 | public function down(): void 24 | { 25 | Schema::dropIfExists('departments'); 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /database/migrations/2024_09_04_170525_kanban_tags.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->string('title'); 17 | $table->string('color'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('kanban_tags'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $policies = [ 17 | 'App\Models\Model' => 'App\Policies\ModelPolicy', 18 | ]; 19 | 20 | /** 21 | * Register any authentication / authorization services. 22 | */ 23 | public function boot(): void 24 | { 25 | 26 | 27 | Passport::enablePasswordGrant(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /database/migrations/2024_08_30_131934_work_positions_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->string('designation'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | // 28 | Schema::dropIfExists('work_position'); 29 | 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205431_create_employee_documents_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->unsignedBigInteger('employee_id'); 15 | $table->string('document_type'); 16 | $table->string('document_path'); 17 | $table->timestamp('uploaded_at'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | 23 | 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('employee_documents'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/migrations/2024_08_30_131920_work_contract_type_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('designation'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::dropIfExists('work_contract_type'); 29 | 30 | // 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 16 | $table->uuid('client_id'); 17 | $table->timestamps(); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::dropIfExists('oauth_personal_access_clients'); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /database/migrations/2024_08_30_131903_work_shifts_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('designation'); 19 | $table->text('content'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('work_shifts'); 30 | // 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2024_09_04_171348_add_display_order_to_kanban_tasks_table.php: -------------------------------------------------------------------------------- 1 | integer('displayOrder')->nullable()->default(0)->after('column_id'); 16 | 17 | }); 18 | } 19 | 20 | /** 21 | * Reverse the migrations. 22 | */ 23 | public function down(): void 24 | { 25 | Schema::table('kanban_tasks', function (Blueprint $table) { 26 | $table->dropColumn('displayOrder'); 27 | }); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/seeders/KanbanTagsSeeder.php: -------------------------------------------------------------------------------- 1 | 'High Priority', 'color' => 'error'], 17 | ['title' => 'Medium Priority', 'color' => 'warning'], 18 | ['title' => 'Low Priority', 'color' => 'info'], 19 | ['title' => 'Feature', 'color' => 'primary'], 20 | ['title' => 'Bug', 'color' => 'secondary'], 21 | ['title' => 'Improvement', 'color' => 'success'], 22 | ]; 23 | 24 | KanbanTags::insert($tags); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Controllers/Structure/PositionController.php: -------------------------------------------------------------------------------- 1 | validate([ 16 | 'designation' => 'required|string|max:255', 17 | ]); 18 | 19 | $department = WorkPosition::create($validatedData); 20 | 21 | 22 | return ApiResponse::success($department, 'Poste created successfully!'); 23 | } 24 | 25 | 26 | public function index() 27 | { 28 | $departments = WorkPosition::all(); 29 | return ApiResponse::success($departments, 'success '); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205447_create_performance_reviews_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->unsignedBigInteger('employee_id'); 15 | $table->date('review_date'); 16 | $table->string('reviewer'); 17 | $table->text('objectives'); 18 | $table->text('comments'); 19 | $table->integer('rating'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | 25 | 26 | public function down(): void 27 | { 28 | Schema::dropIfExists('performance_reviews'); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /routes/api/structure.php: -------------------------------------------------------------------------------- 1 | group(function () { 10 | Route::get('/lister', [DepartmentController::class, 'index']); 11 | 12 | Route::post('/add', [DepartmentController::class, 'store']); 13 | 14 | Route::get('/show/{id}', [DepartmentController::class, 'show']); 15 | 16 | Route::put('/update/{id}', [DepartmentController::class, 'update']); 17 | 18 | Route::delete('/delete/{id}', [DepartmentController::class, 'destroy']); 19 | }); 20 | 21 | 22 | 23 | 24 | Route::prefix('position')->group(function () { 25 | 26 | Route::post('/add', [PositionController::class, 'store']); 27 | Route::get('/lister', [PositionController::class, 'index']); 28 | 29 | }); 30 | -------------------------------------------------------------------------------- /database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->string('access_token_id', 100)->index(); 17 | $table->boolean('revoked'); 18 | $table->dateTime('expires_at')->nullable(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('oauth_refresh_tokens'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/migrations/2024_08_20_190052_add_user_id_to_employees.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('user_id')->after('id'); 13 | 14 | $table->foreign('user_id') 15 | ->references('id') 16 | ->on('users') 17 | ->onDelete('cascade'); 18 | }); 19 | } 20 | 21 | 22 | public function down() 23 | { 24 | Schema::table('employees', function (Blueprint $table) { 25 | $table->dropForeign(['user_id']); 26 | 27 | $table->dropColumn('user_id'); 28 | }); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /database/migrations/2024_08_30_134744_add_foreign_keys_to_attendance_table.php: -------------------------------------------------------------------------------- 1 | foreign('employee_id')->references('id')->on('employees')->onDelete('cascade'); 17 | 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | */ 24 | public function down(): void 25 | { 26 | Schema::table('attendance', function (Blueprint $table) { 27 | // 28 | $table->dropForeign(['employee_id']); 29 | 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/seeders/JobOfferSeeder.php: -------------------------------------------------------------------------------- 1 | 'Senior Developer', 14 | 'slug' => 'senior-developer', 15 | 'department_id' => 2, 16 | 'location' => 'Remote', 17 | 'min_experience' => 5, 18 | 'max_experience' => 10, 19 | 'tags' => ['development', 'software'], 20 | 'short_description' => 'shortsquhdi ysqdkhqskljd hsqkljdh qkjsdhqjs', 21 | 'requirements' => 'jhsqgd jqgsjdh qgsjdhg qshdguqsdygqsjdhqsdqsdqsd', 22 | 'expire_at' => now()->addDays(30), 23 | 'status' => 'Open', 24 | 'contract_type_id' => 1, 25 | ]); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /database/migrations/2024_09_04_170534_kanban_task_tag.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->foreignId('kanban_task_id')->constrained('kanban_tasks')->onDelete('cascade'); 17 | $table->foreignId('kanban_tags_id')->constrained('kanban_tags')->onDelete('cascade'); 18 | $table->timestamps(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | */ 25 | public function down(): void 26 | { 27 | Schema::dropIfExists('kanban_task_tag'); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 24 | return redirect(RouteServiceProvider::HOME); 25 | } 26 | } 27 | 28 | return $next($request); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /database/migrations/2024_08_20_184942_add_job_offer_id_to_candidates.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('job_offer_id')->nullable(); 13 | 14 | $table->foreign('job_offer_id') 15 | ->references('id') 16 | ->on('job_offers') 17 | ->onDelete('set null'); 18 | }); 19 | } 20 | 21 | public function down() 22 | { 23 | Schema::table('candidates', function (Blueprint $table) { 24 | $table->dropForeign(['job_offer_id']); 25 | 26 | $table->dropColumn('job_offer_id'); 27 | }); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /database/seeders/EmployeeSeeder.php: -------------------------------------------------------------------------------- 1 | 'shaheen', 14 | 'last_name' => 'jawadi', 15 | 'email' => 'jawadishaheen@gmail.com', 16 | 'phone' => '52723344', 17 | 'birthday' => '1998-05-05', 18 | 'sexe' => 'h', 19 | 'avatar' => '', 20 | 'hire_date' => now(), 21 | 'end_contract' => null, 22 | 'contract_type_id' => 1, 23 | 'department_id' => 2, 24 | 'shift_id' => 1, 25 | 'supervisor_id' => null, 26 | 'position_id' => 1, 27 | 'additional_infos' => [], 28 | 'user_id' => 2, 29 | ]); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Models/JobOffer.php: -------------------------------------------------------------------------------- 1 | 'array', 19 | ]; 20 | 21 | public function candidates() 22 | { 23 | return $this->hasMany(Candidate::class, 'job_offer_id', 'id'); 24 | } 25 | public function department() 26 | { 27 | return $this->belongsTo(Department::class); 28 | } 29 | public function contractType() 30 | { 31 | return $this->belongsTo(WorkContractType::class); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2024_08_30_134324_add_foreign_keys_to_job_offers_table.php: -------------------------------------------------------------------------------- 1 | foreign('department_id')->references('id')->on('departments')->onDelete('cascade'); 17 | 18 | 19 | }); 20 | 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::table('job_offers', function (Blueprint $table) { 29 | // 30 | $table->dropForeign(['department_id']); 31 | 32 | }); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/0001_01_01_000001_create_cache_table.php: -------------------------------------------------------------------------------- 1 | string('key')->primary(); 14 | $table->mediumText('value'); 15 | $table->integer('expiration'); 16 | }); 17 | 18 | Schema::create('cache_locks', function (Blueprint $table) { 19 | $table->string('key')->primary(); 20 | $table->string('owner'); 21 | $table->integer('expiration'); 22 | }); 23 | } 24 | 25 | 26 | public function down(): void 27 | { 28 | Schema::dropIfExists('cache'); 29 | Schema::dropIfExists('cache_locks'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->unsignedBigInteger('user_id')->index(); 17 | $table->uuid('client_id'); 18 | $table->text('scopes')->nullable(); 19 | $table->boolean('revoked'); 20 | $table->dateTime('expires_at')->nullable(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('oauth_auth_codes'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /database/migrations/2024_08_29_203924_create_kanban_tasks.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->unsignedBigInteger('column_id'); 17 | $table->string('title'); 18 | $table->timestamps(); 19 | $table->unsignedBigInteger('assigned_by')->nullable(); 20 | $table->unsignedBigInteger('assigned_to')->nullable(); 21 | 22 | 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('kanban_tasks'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/seeders/CandidateSeeder.php: -------------------------------------------------------------------------------- 1 | 'Shaheen jawadi', 16 | 'email' => 'contact@shaheenj.com', 17 | 'phone' => '1234567890', 18 | 'actual_position' => 'Software Developer', 19 | 'linkedin_profile' => '', 20 | 'github_profile' => 'https://github.com/ShaheenJawadi', 21 | 'motivation' => 'Passionate about coding.', 22 | 'birthday' => '1998-01-01', 23 | 'resume_path' => '', 24 | 'status' => 'Applied', 25 | 'submitted_at' => now(), 26 | 'last_status_change' => now(), 27 | 'job_offer_id' => 1, 28 | ]); 29 | } 30 | } -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205458_create_leave_requests_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->unsignedBigInteger('employee_id'); 15 | $table->date('start_date'); 16 | $table->date('end_date'); 17 | $table->string('leave_type'); 18 | $table->string('comments')->nullable(); 19 | 20 | $table->enum('status', ['approved', 'pending', 'rejected']); 21 | $table->text('manager_comments')->nullable(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | 27 | public function down(): void 28 | { 29 | Schema::dropIfExists('leave_requests'); 30 | } 31 | }; 32 | -------------------------------------------------------------------------------- /app/Http/Controllers/AuthController.php: -------------------------------------------------------------------------------- 1 | email)->first(); 18 | if ($user && Hash::check($request->password, $user->password)) { 19 | 20 | $token = $user->createToken('accessToken')->accessToken; 21 | 22 | $userData = [ 23 | 'token' => $token, 24 | 'user' => $user, 25 | ]; 26 | 27 | return ApiResponse::success($userData, 'success'); 28 | 29 | return response()->json(['message' => $token]); 30 | } else { 31 | return ApiResponse::error('Les identifiants sont incorrects.'); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2024_09_01_124905_contract_type_id_in_joboffer_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('contract_type_id')->nullable(); 17 | $table->foreign('contract_type_id')->references('id')->on('work_contract_type')->onDelete('set null'); 18 | 19 | 20 | }); 21 | 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | */ 27 | public function down(): void 28 | { 29 | Schema::table('employee', function (Blueprint $table) { 30 | 31 | $table->dropForeign(['contract_type_id']); 32 | 33 | 34 | }); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | */ 26 | public function boot(): void 27 | { 28 | // 29 | } 30 | 31 | /** 32 | * Determine if events and listeners should be automatically discovered. 33 | */ 34 | public function shouldDiscoverEvents(): bool 35 | { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /database/seeders/UserSeeder.php: -------------------------------------------------------------------------------- 1 | 'ss', 19 | 'email' => 'a@b.c', 20 | 'role' => 'admin', 21 | 'password' => Hash::make('testpassword'), 22 | ]); 23 | 24 | 25 | User::create([ 26 | 'name' => 'shaheen', 27 | 'email' => 'contact@shaheenj.com', 28 | 'role' => 'employee', 29 | 'password' => Hash::make('testpassword'), 30 | ]); 31 | 32 | User::create([ 33 | 'name' => 'qsdsqdsqd', 34 | 'email' => 'c@c.c', 35 | 'role' => 'manager', 36 | 'password' => Hash::make('testpassword'), 37 | ]); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | string('id', 100)->primary(); 16 | $table->unsignedBigInteger('user_id')->nullable()->index(); 17 | $table->uuid('client_id'); 18 | $table->string('name')->nullable(); 19 | $table->text('scopes')->nullable(); 20 | $table->boolean('revoked'); 21 | $table->timestamps(); 22 | $table->dateTime('expires_at')->nullable(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | */ 29 | public function down(): void 30 | { 31 | Schema::dropIfExists('oauth_access_tokens'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /app/Models/KanbanTask.php: -------------------------------------------------------------------------------- 1 | belongsTo(KanbanColumn::class, 'column_id'); 16 | } 17 | 18 | public function assignedBy() 19 | { 20 | return $this->belongsTo(Employee::class, 'assigned_by'); 21 | } 22 | 23 | public function assignedTo() 24 | { 25 | return $this->belongsTo(Employee::class, 'assigned_to'); 26 | } 27 | 28 | public function tags() 29 | { 30 | return $this->belongsToMany(KanbanTags::class, 'kanban_task_tag'); 31 | } 32 | 33 | 34 | /** 35 | * Get the tags 36 | * 37 | * @return \Illuminate\Database\Eloquent\Collection 38 | */ 39 | public function getTagsAttribute() 40 | { 41 | return $this->tags()->get(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /storage/api-docs/api-docs.json: -------------------------------------------------------------------------------- 1 | { 2 | "openapi": "3.0.0", 3 | "info": { 4 | "title": "Test API", 5 | "version": "1.0.0" 6 | }, 7 | "paths": { 8 | "/api/employee": { 9 | "get": { 10 | "summary": "Test employee endpoint", 11 | "operationId": "4ec9fd94af8c488b3574c29cf8e75bd2", 12 | "responses": { 13 | "200": { 14 | "description": "Success", 15 | "content": { 16 | "application/json": { 17 | "schema": { 18 | "properties": { 19 | "message": { 20 | "type": "string" 21 | } 22 | }, 23 | "type": "object" 24 | } 25 | } 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /database/migrations/2016_06_01_000004_create_oauth_clients_table.php: -------------------------------------------------------------------------------- 1 | id(); 16 | $table->unsignedBigInteger('user_id')->nullable()->index(); 17 | $table->string('name'); 18 | $table->string('secret', 100)->nullable(); 19 | $table->string('provider')->nullable(); 20 | $table->text('redirect'); 21 | $table->boolean('personal_access_client'); 22 | $table->boolean('password_client'); 23 | $table->boolean('revoked'); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | */ 31 | public function down(): void 32 | { 33 | Schema::dropIfExists('oauth_clients'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205442_create_job_offers_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->string('title'); 15 | $table->string('slug'); 16 | 17 | $table->unsignedBigInteger('department_id')->nullable(); 18 | $table->string('location'); 19 | $table->integer('min_experience'); 20 | $table->integer('max_experience')->nullable(); 21 | $table->string('tags')->nullable(); 22 | 23 | 24 | 25 | $table->text('short_description'); 26 | $table->text('requirements'); 27 | $table->date('expire_at')->nullable(); 28 | $table->enum('status', ['open', 'closed']); 29 | $table->timestamps(); 30 | }); 31 | } 32 | 33 | 34 | 35 | public function down(): void 36 | { 37 | Schema::dropIfExists('job_offers'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /database/migrations/2024_08_29_202341_create_attendance_table.php: -------------------------------------------------------------------------------- 1 | id(); 17 | $table->unsignedBigInteger('employee_id'); 18 | $table->date('date'); 19 | $table->time('clock_in_time'); 20 | $table->time('clock_out_time'); 21 | $table->time('expected_clock_in_time'); 22 | $table->time('expected_clock_out_time'); 23 | $table->enum('status', ['present', 'absent', 'late']); 24 | $table->timestamps(); 25 | 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | */ 32 | public function down(): void 33 | { 34 | Schema::dropIfExists('attendance'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /app/Utils/ApiResponse.php: -------------------------------------------------------------------------------- 1 | json([ 18 | 'success' => true, 19 | 'message' => $message, 20 | 'data' => $data, 21 | ], $statusCode); 22 | } 23 | 24 | /** 25 | * Generate an error response. 26 | * 27 | * @param string $message 28 | * @param string|null $error 29 | * @param int $statusCode 30 | * @return \Illuminate\Http\JsonResponse 31 | */ 32 | public static function error($message = 'Operation failed', $error = null, $statusCode = 500) 33 | { 34 | return response()->json([ 35 | 'success' => false, 36 | 'message' => $message, 37 | 'error' => $error, 38 | ], $statusCode); 39 | } 40 | } -------------------------------------------------------------------------------- /app/Http/Controllers/UtilsController.php: -------------------------------------------------------------------------------- 1 | get(); 20 | 21 | 22 | return ApiResponse::success($kanbanData, 'success '); 23 | } 24 | 25 | 26 | public function updateKanban(Request $request) 27 | { 28 | $data = $request->input(); 29 | 30 | foreach ($data as $columnData) { 31 | 32 | foreach ($columnData['tasks'] as $taskData) { 33 | KanbanTask::where('id', $taskData['id'])->update( 34 | [ 35 | 'column_id' => $taskData['column_id'], 36 | 'displayOrder' => $taskData['displayOrder'], 37 | ] 38 | ); 39 | 40 | 41 | } 42 | } 43 | 44 | return ApiResponse::success('Data updated successfully', 'success '); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | foreign('column_id')->references('id')->on('kanban_columns')->onDelete('cascade'); 18 | $table->foreign('assigned_by')->references('id')->on('employees')->onDelete('cascade'); 19 | $table->foreign('assigned_to')->references('id')->on('employees')->onDelete('cascade'); 20 | 21 | 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::table('kanban_tasks', function (Blueprint $table) { 31 | // 32 | $table->dropForeign(['column_id']); 33 | $table->dropForeign(['assigned_by']); 34 | $table->dropForeign(['assigned_to']); 35 | 36 | 37 | }); 38 | 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | tests/Unit 10 | 11 | 12 | tests/Feature 13 | 14 | 15 | 16 | 17 | app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class UserFactory extends Factory 13 | { 14 | /** 15 | * The current password being used by the factory. 16 | */ 17 | protected static ?string $password; 18 | 19 | /** 20 | * Define the model's default state. 21 | * 22 | * @return array 23 | */ 24 | public function definition(): array 25 | { 26 | return [ 27 | 'name' => fake()->name(), 28 | 'email' => fake()->unique()->safeEmail(), 29 | 'email_verified_at' => now(), 30 | 'password' => static::$password ??= Hash::make('password'), 31 | 'remember_token' => Str::random(10), 32 | ]; 33 | } 34 | 35 | /** 36 | * Indicate that the model's email address should be unverified. 37 | */ 38 | public function unverified(): static 39 | { 40 | return $this->state(fn (array $attributes) => [ 41 | 'email_verified_at' => null, 42 | ]); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205424_create_candidates_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->string('full_name'); 15 | $table->string('email'); 16 | $table->string('phone'); 17 | $table->string('actual_position'); 18 | $table->string('linkedin_profile')->nullable(); 19 | $table->string('github_profile')->nullable(); 20 | $table->text('motivation')->nullable(); 21 | 22 | 23 | 24 | $table->date('birthday'); 25 | 26 | $table->string('resume_path'); 27 | $table->enum('status', ['pending','accepted','rejected','shortlisted']); 28 | $table->timestamp('submitted_at'); 29 | $table->timestamp('last_status_change')->nullable(); 30 | $table->timestamps(); 31 | }); 32 | } 33 | 34 | 35 | public function down(): void 36 | { 37 | Schema::dropIfExists('candidates'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | 19 | 20 | public function render($request, Throwable $exception) 21 | { 22 | if ($exception instanceof ValidationException) { 23 | if ($request->wantsJson()) { 24 | return response()->json([ 25 | 'success' => false, 26 | 'errorType' => 'FormValidation', 27 | 'errors' => $exception->errors(), 28 | ], 422); 29 | } 30 | } 31 | 32 | return parent::render($request, $exception); 33 | } 34 | protected $dontFlash = [ 35 | 'current_password', 36 | 'password', 37 | 'password_confirmation', 38 | ]; 39 | 40 | /** 41 | * Register the exception handling callbacks for the application. 42 | */ 43 | public function register(): void 44 | { 45 | $this->reportable(function (Throwable $e) { 46 | // 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * We'll load the axios HTTP library which allows us to easily issue requests 3 | * to our Laravel back-end. This library automatically handles sending the 4 | * CSRF token as a header based on the value of the "XSRF" token cookie. 5 | */ 6 | 7 | import axios from 'axios'; 8 | window.axios = axios; 9 | 10 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 11 | 12 | /** 13 | * Echo exposes an expressive API for subscribing to channels and listening 14 | * for events that are broadcast by Laravel. Echo and event broadcasting 15 | * allows your team to easily build robust real-time web applications. 16 | */ 17 | 18 | // import Echo from 'laravel-echo'; 19 | 20 | // import Pusher from 'pusher-js'; 21 | // window.Pusher = Pusher; 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 26 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 27 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 28 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 29 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 30 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 31 | // enabledTransports: ['ws', 'wss'], 32 | // }); 33 | -------------------------------------------------------------------------------- /database/migrations/2024_08_30_132444_add_foreign_keys_to_employee_table.php: -------------------------------------------------------------------------------- 1 | foreign('contract_type_id')->references('id')->on('work_contract_type')->onDelete('set null'); 17 | $table->foreign('shift_id')->references('id')->on('work_shifts')->onDelete('set null'); 18 | $table->foreign('supervisor_id')->references('id')->on('employees')->onDelete('set null'); 19 | $table->foreign('position_id')->references('id')->on('work_positions')->onDelete('set null'); 20 | 21 | }); 22 | 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | */ 28 | public function down(): void 29 | { 30 | Schema::table('employee', function (Blueprint $table) { 31 | 32 | $table->dropForeign(['contract_type_id']); 33 | $table->dropForeign(['shift_id']); 34 | $table->dropForeign(['supervisor_id']); 35 | $table->dropForeign(['position_id']); 36 | 37 | 38 | }); 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /database/seeders/KanbanTasksSeeder.php: -------------------------------------------------------------------------------- 1 | 1, 'title' => 'Task 1', 'displayOrder' => 1, 'assigned_by' => 2, 'assigned_to' => 7], 18 | ['column_id' => 1, 'title' => 'Task 2', 'displayOrder' => 2, 'assigned_by' => 3, 'assigned_to' => 8], 19 | ['column_id' => 2, 'title' => 'Task 3', 'displayOrder' => 1, 'assigned_by' => 2, 'assigned_to' => 8], 20 | ['column_id' => 3, 'title' => 'Task 4', 'displayOrder' => 2, 'assigned_by' => 3, 'assigned_to' => 8], 21 | ]; 22 | 23 | KanbanTask::insert($tasks); 24 | 25 | $taskTags = [ 26 | ['kanban_task_id' => 1, 'kanban_tag_id' => 1], 27 | ['kanban_task_id' => 1, 'kanban_tag_id' => 2], 28 | ['kanban_task_id' => 2, 'kanban_tag_id' => 2], 29 | ['kanban_task_id' => 3, 'kanban_tag_id' => 3], 30 | ['kanban_task_id' => 4, 'kanban_tag_id' => 4], 31 | ]; 32 | 33 | DB::table('kanban_task_tag')->insert($taskTags); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2024_08_20_173744_add_foreign_keys_to_tables.php: -------------------------------------------------------------------------------- 1 | foreign('department_id')->references('id')->on('departments')->onDelete('set null'); 14 | }); 15 | 16 | Schema::table('departments', function (Blueprint $table) { 17 | if (!Schema::hasColumn('departments', 'manager_id')) { 18 | $table->unsignedBigInteger('manager_id')->nullable()->after('location'); 19 | } 20 | 21 | $table->foreign('manager_id')->references('id')->on('employees')->onDelete('set null'); 22 | }); 23 | } 24 | 25 | public function down() 26 | { 27 | Schema::table('employees', function (Blueprint $table) { 28 | if (Schema::hasColumn('employees', 'department_id')) { 29 | $table->dropForeign(['department_id']); 30 | } 31 | }); 32 | 33 | Schema::table('departments', function (Blueprint $table) { 34 | if (Schema::hasColumn('departments', 'manager_id')) { 35 | $table->dropForeign(['manager_id']); 36 | } 37 | }); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | PASSPORT_PERSONAL_ACCESS_CLIENT_ID="" 8 | PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET="" 9 | 10 | LOG_CHANNEL=stack 11 | LOG_DEPRECATIONS_CHANNEL=null 12 | LOG_LEVEL=debug 13 | 14 | DB_CONNECTION=mysql 15 | DB_HOST=127.0.0.1 16 | DB_PORT=3306 17 | DB_DATABASE=laravel 18 | DB_USERNAME=root 19 | DB_PASSWORD= 20 | 21 | BROADCAST_DRIVER=log 22 | CACHE_DRIVER=file 23 | FILESYSTEM_DISK=local 24 | QUEUE_CONNECTION=sync 25 | SESSION_DRIVER=file 26 | SESSION_LIFETIME=120 27 | 28 | MEMCACHED_HOST=127.0.0.1 29 | 30 | REDIS_HOST=127.0.0.1 31 | REDIS_PASSWORD=null 32 | REDIS_PORT=6379 33 | 34 | MAIL_MAILER=smtp 35 | MAIL_HOST=mailpit 36 | MAIL_PORT=1025 37 | MAIL_USERNAME=null 38 | MAIL_PASSWORD=null 39 | MAIL_ENCRYPTION=null 40 | MAIL_FROM_ADDRESS="hello@example.com" 41 | MAIL_FROM_NAME="${APP_NAME}" 42 | 43 | AWS_ACCESS_KEY_ID= 44 | AWS_SECRET_ACCESS_KEY= 45 | AWS_DEFAULT_REGION=us-east-1 46 | AWS_BUCKET= 47 | AWS_USE_PATH_STYLE_ENDPOINT=false 48 | 49 | PUSHER_APP_ID= 50 | PUSHER_APP_KEY= 51 | PUSHER_APP_SECRET= 52 | PUSHER_HOST= 53 | PUSHER_PORT=443 54 | PUSHER_SCHEME=https 55 | PUSHER_APP_CLUSTER=mt1 56 | 57 | VITE_APP_NAME="${APP_NAME}" 58 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 59 | VITE_PUSHER_HOST="${PUSHER_HOST}" 60 | VITE_PUSHER_PORT="${PUSHER_PORT}" 61 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 62 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 63 | -------------------------------------------------------------------------------- /database/migrations/2024_08_15_205417_create_employees_table.php: -------------------------------------------------------------------------------- 1 | id('id'); 14 | $table->string('name'); 15 | $table->string('last_name'); 16 | $table->string('email')->unique(); 17 | $table->string('phone'); 18 | $table->date('birthday'); 19 | $table->string('sexe'); 20 | $table->string('avatar')->nullable(); 21 | 22 | 23 | 24 | 25 | $table->date('hire_date')->nullable();; 26 | $table->date('end_contract')->nullable();; 27 | 28 | $table->unsignedBigInteger('contract_type_id')->nullable(); 29 | 30 | $table->unsignedBigInteger('department_id')->nullable(); 31 | $table->unsignedBigInteger('shift_id')->nullable(); 32 | $table->unsignedBigInteger('supervisor_id')->nullable(); 33 | $table->unsignedBigInteger('position_id')->nullable(); 34 | 35 | 36 | $table->text('additional_infos'); 37 | $table->timestamps(); 38 | }); 39 | } 40 | 41 | 42 | 43 | public function down(): void 44 | { 45 | Schema::dropIfExists('employees'); 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 21 | */ 22 | protected $fillable = [ 23 | 'name', 24 | 'email', 25 | 'role', 26 | 'password', 27 | ]; 28 | 29 | /** 30 | * The attributes that should be hidden for serialization. 31 | * 32 | * @var array 33 | */ 34 | protected $hidden = [ 35 | 'password', 36 | 'remember_token', 37 | ]; 38 | 39 | /** 40 | * Get the attributes that should be cast. 41 | * 42 | * @return array 43 | */ 44 | protected function casts(): array 45 | { 46 | return [ 47 | 'email_verified_at' => 'datetime', 48 | 'password' => 'hashed', 49 | ]; 50 | } 51 | 52 | public function employee() 53 | { 54 | return $this->hasOne(Employee::class, 'user_id'); 55 | } 56 | 57 | public function candidate() 58 | { 59 | return $this->hasOne(Candidate::class, 'user_id'); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /database/migrations/0001_01_01_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->string('name'); 15 | $table->string('email')->unique(); 16 | $table->timestamp('email_verified_at')->nullable(); 17 | $table->enum('role', ['admin', 'employee', 'manager']); 18 | $table->string('password'); 19 | $table->rememberToken(); 20 | $table->timestamps(); 21 | }); 22 | 23 | Schema::create('password_reset_tokens', function (Blueprint $table) { 24 | $table->string('email')->primary(); 25 | $table->string('token'); 26 | $table->timestamp('created_at')->nullable(); 27 | }); 28 | 29 | Schema::create('sessions', function (Blueprint $table) { 30 | $table->string('id')->primary(); 31 | $table->foreignId('user_id')->nullable()->index(); 32 | $table->string('ip_address', 45)->nullable(); 33 | $table->text('user_agent')->nullable(); 34 | $table->longText('payload'); 35 | $table->integer('last_activity')->index(); 36 | }); 37 | } 38 | 39 | 40 | public function down(): void 41 | { 42 | Schema::dropIfExists('users'); 43 | Schema::dropIfExists('password_reset_tokens'); 44 | Schema::dropIfExists('sessions'); 45 | } 46 | }; 47 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 12), 33 | 'verify' => true, 34 | ], 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Argon Options 39 | |-------------------------------------------------------------------------- 40 | | 41 | | Here you may specify the configuration options that should be used when 42 | | passwords are hashed using the Argon algorithm. These will allow you 43 | | to control the amount of time it takes to hash the given password. 44 | | 45 | */ 46 | 47 | 'argon' => [ 48 | 'memory' => 65536, 49 | 'threads' => 1, 50 | 'time' => 4, 51 | 'verify' => true, 52 | ], 53 | 54 | ]; 55 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /database/migrations/0001_01_01_000002_create_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 14 | $table->string('queue')->index(); 15 | $table->longText('payload'); 16 | $table->unsignedTinyInteger('attempts'); 17 | $table->unsignedInteger('reserved_at')->nullable(); 18 | $table->unsignedInteger('available_at'); 19 | $table->unsignedInteger('created_at'); 20 | }); 21 | 22 | Schema::create('job_batches', function (Blueprint $table) { 23 | $table->string('id')->primary(); 24 | $table->string('name'); 25 | $table->integer('total_jobs'); 26 | $table->integer('pending_jobs'); 27 | $table->integer('failed_jobs'); 28 | $table->longText('failed_job_ids'); 29 | $table->mediumText('options')->nullable(); 30 | $table->integer('cancelled_at')->nullable(); 31 | $table->integer('created_at'); 32 | $table->integer('finished_at')->nullable(); 33 | }); 34 | 35 | Schema::create('failed_jobs', function (Blueprint $table) { 36 | $table->id(); 37 | $table->string('uuid')->unique(); 38 | $table->text('connection'); 39 | $table->text('queue'); 40 | $table->longText('payload'); 41 | $table->longText('exception'); 42 | $table->timestamp('failed_at')->useCurrent(); 43 | }); 44 | } 45 | 46 | 47 | public function down(): void 48 | { 49 | Schema::dropIfExists('jobs'); 50 | Schema::dropIfExists('job_batches'); 51 | Schema::dropIfExists('failed_jobs'); 52 | } 53 | }; 54 | -------------------------------------------------------------------------------- /app/Http/Controllers/PublicJobListing/JobListingController.php: -------------------------------------------------------------------------------- 1 | validate([ 19 | 'full_name' => 'required|string|max:255', 20 | 'email' => 'required|email|max:255', 21 | 'phone' => 'required|string|max:20', 22 | 'actual_position' => 'nullable|string|max:255', 23 | 'linkedin_profile' => 'nullable|url|max:255', 24 | 'github_profile' => 'nullable|url|max:255', 25 | 'motivation' => 'nullable|string', 26 | 'birthday' => 'nullable|date', 27 | 'resume_path' => 'nullable|string|max:255', 28 | 29 | 'job_offer_id' => 'required|exists:job_offers,id', 30 | ]); 31 | 32 | $validatedData['submitted_at'] = now(); 33 | $validatedData['status'] = 'pending'; 34 | $validatedData['last_status_change'] = now(); 35 | $validatedData['resume_path'] = "todo"; 36 | 37 | 38 | 39 | 40 | $candidate = Candidate::create($validatedData); 41 | 42 | return ApiResponse::success($candidate, 'Candidate application submitted successfully!'); 43 | } 44 | 45 | 46 | 47 | 48 | 49 | public function index() 50 | { 51 | $jobOffers = JobOffer::all(); 52 | return ApiResponse::success($jobOffers, 'success '); 53 | } 54 | 55 | 56 | public function show($slug) 57 | { 58 | $jobOffer = JobOffer::where('slug', $slug)->first(); 59 | 60 | if (!$jobOffer) { 61 | return ApiResponse::error(null, 'Job offer not found', 404); 62 | } 63 | 64 | return ApiResponse::success($jobOffer, 'Job offer retrieved successfully'); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The skeleton application for the Laravel framework.", 5 | "keywords": ["laravel", "framework"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.1", 9 | "darkaonline/l5-swagger": "^8.6", 10 | "guzzlehttp/guzzle": "^7.2", 11 | "laravel/framework": "^10.10", 12 | "laravel/passport": "^12.3", 13 | "laravel/sanctum": "^3.3", 14 | "laravel/tinker": "^2.8" 15 | }, 16 | "require-dev": { 17 | "fakerphp/faker": "^1.9.1", 18 | "laravel/pint": "^1.0", 19 | "laravel/sail": "^1.18", 20 | "mockery/mockery": "^1.4.4", 21 | "nunomaduro/collision": "^7.0", 22 | "phpunit/phpunit": "^10.1", 23 | "spatie/laravel-ignition": "^2.0" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "App\\": "app/", 28 | "Database\\Factories\\": "database/factories/", 29 | "Database\\Seeders\\": "database/seeders/" 30 | } 31 | }, 32 | "autoload-dev": { 33 | "psr-4": { 34 | "Tests\\": "tests/" 35 | } 36 | }, 37 | "scripts": { 38 | "post-autoload-dump": [ 39 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 40 | "@php artisan package:discover --ansi" 41 | ], 42 | "post-update-cmd": [ 43 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 44 | ], 45 | "post-root-package-install": [ 46 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 47 | ], 48 | "post-create-project-cmd": [ 49 | "@php artisan key:generate --ansi" 50 | ] 51 | }, 52 | "extra": { 53 | "laravel": { 54 | "dont-discover": [] 55 | } 56 | }, 57 | "config": { 58 | "optimize-autoloader": true, 59 | "preferred-install": "dist", 60 | "sort-packages": true, 61 | "allow-plugins": { 62 | "pestphp/pest-plugin": true, 63 | "php-http/discovery": true 64 | } 65 | }, 66 | "minimum-stability": "stable", 67 | "prefer-stable": true 68 | } 69 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 41 | 'port' => env('PUSHER_PORT', 443), 42 | 'scheme' => env('PUSHER_SCHEME', 'https'), 43 | 'encrypted' => true, 44 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 45 | ], 46 | 'client_options' => [ 47 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 48 | ], 49 | ], 50 | 51 | 'ably' => [ 52 | 'driver' => 'ably', 53 | 'key' => env('ABLY_KEY'), 54 | ], 55 | 56 | 'redis' => [ 57 | 'driver' => 'redis', 58 | 'connection' => 'default', 59 | ], 60 | 61 | 'log' => [ 62 | 'driver' => 'log', 63 | ], 64 | 65 | 'null' => [ 66 | 'driver' => 'null', 67 | ], 68 | 69 | ], 70 | 71 | ]; 72 | -------------------------------------------------------------------------------- /app/Models/Employee.php: -------------------------------------------------------------------------------- 1 | 'array', 40 | ]; 41 | 42 | public function department(): BelongsTo 43 | { 44 | return $this->belongsTo(Department::class); 45 | } 46 | public function user(): BelongsTo 47 | { 48 | return $this->belongsTo(User::class); 49 | } 50 | 51 | public function supervisor(): BelongsTo 52 | { 53 | return $this->belongsTo(Employee::class, 'supervisor_id'); 54 | } 55 | 56 | public function position(): BelongsTo 57 | { 58 | return $this->belongsTo(WorkPosition::class); 59 | } 60 | 61 | public function shift(): BelongsTo 62 | { 63 | return $this->belongsTo(WorkShift::class); 64 | } 65 | 66 | public function contractType(): BelongsTo 67 | { 68 | return $this->belongsTo(WorkContractType::class); 69 | } 70 | 71 | public function documents(): HasMany 72 | { 73 | return $this->hasMany(EmployeeDocument::class); 74 | } 75 | 76 | public function performanceReviews(): HasMany 77 | { 78 | return $this->hasMany(PerformanceReview::class); 79 | } 80 | 81 | public function attendance(): HasMany 82 | { 83 | return $this->hasMany(Attendance::class); 84 | } 85 | 86 | public function assignedTasks(): HasMany 87 | { 88 | return $this->hasMany(KanbanTask::class, 'assigned_to'); 89 | } 90 | 91 | public function tasksAssignedBy(): HasMany 92 | { 93 | return $this->hasMany(KanbanTask::class, 'assigned_by'); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | by($request->user()?->id ?: $request->ip()); 29 | }); 30 | 31 | $this->routes(function () { 32 | 33 | 34 | Route::middleware('api') 35 | ->prefix('api') 36 | ->group(function () { 37 | 38 | 39 | Route::prefix('auth') 40 | ->group(base_path('routes/api/auth.php')); 41 | 42 | Route::prefix('structure') 43 | ->group(base_path('routes/api/structure.php')); 44 | 45 | Route::prefix('employee') 46 | ->group(base_path('routes/api/employee.php')); 47 | 48 | 49 | 50 | Route::prefix('JobOffer') 51 | ->group(base_path('routes/api/JobOffer.php')); 52 | 53 | 54 | 55 | Route::prefix('publicListing') 56 | ->group(base_path('routes/api/publicListing.php')); 57 | 58 | 59 | Route::prefix('utils') 60 | ->group(base_path('routes/api/utils.php')); 61 | 62 | 63 | Route::prefix('user') 64 | ->group(base_path('routes/api/user.php')); 65 | 66 | 67 | 68 | Route::prefix('candidate') 69 | ->group(base_path('routes/api/candidate.php')); 70 | }); 71 | 72 | Route::middleware('api') 73 | ->group(base_path('routes/api.php')); 74 | 75 | 76 | 77 | 78 | Route::middleware('web') 79 | ->group(base_path('routes/web.php')); 80 | }); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/Http/Controllers/Structure/DepartmentController.php: -------------------------------------------------------------------------------- 1 | validate([ 25 | 'name' => 'required|string|max:255', 26 | 'location' => 'required|string|max:255', 27 | 'manager_id' => 'nullable|exists:employees,id', 28 | ]); 29 | 30 | $department = Department::create($validatedData); 31 | 32 | 33 | return ApiResponse::success($department, 'Department created successfully!'); 34 | } 35 | 36 | 37 | 38 | public function update(Request $request, $id) 39 | { 40 | $department = Department::find($id); 41 | 42 | if (!$department) { 43 | return ApiResponse::error('Department not found'); 44 | } 45 | 46 | $validator = Validator::make($request->all(), [ 47 | 'name' => 'sometimes|required|string|max:255', 48 | 'location' => 'sometimes|required|string|max:255', 49 | 'manager_id' => 'nullable|exists:employees,id', 50 | ]); 51 | 52 | if ($validator->fails()) { 53 | return ApiResponse::error('Department not found', $validator->errors());; 54 | } 55 | 56 | $department->update($request->all()); 57 | 58 | return ApiResponse::success($department, 'Department updated successfully!'); 59 | } 60 | 61 | public function show($id) 62 | { 63 | $department = Department::find($id); 64 | 65 | if (!$department) { 66 | return ApiResponse::error('Department not found'); 67 | } 68 | 69 | return ApiResponse::success($department, ' success '); 70 | } 71 | 72 | 73 | public function destroy($id) 74 | { 75 | $department = Department::find($id); 76 | 77 | if (!$department) { 78 | return ApiResponse::error('Department not found'); 79 | } 80 | 81 | $department->delete(); 82 | 83 | 84 | return ApiResponse::success($department, 'Department deleted successfully'); 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /app/Http/Controllers/CandidateController.php: -------------------------------------------------------------------------------- 1 | json($candidates); 16 | } 17 | 18 | public function store(Request $request) 19 | { 20 | $validatedData = $request->validate([ 21 | 'user_id' => 'required|exists:users,id', 22 | 'job_offer_id' => 'required|exists:job_offers,id', 23 | 'resume_path' => 'nullable|string|max:255', 24 | 'status' => 'required|string|max:50', 25 | 'submitted_at' => 'required|date', 26 | 'last_status_change' => 'nullable|date', 27 | 'employee_id' => 'nullable|exists:employees,employee_id', 28 | ]); 29 | 30 | $candidate = Candidate::create($validatedData); 31 | 32 | return ApiResponse::success($candidate, 'Candidate created successfully!'); 33 | 34 | } 35 | 36 | 37 | 38 | public function show($id) 39 | { 40 | $candidate = Candidate::find($id); 41 | 42 | if (!$candidate) { 43 | return ApiResponse::error('Candidate not found'); 44 | 45 | } 46 | return ApiResponse::success($candidate, ' success '); 47 | 48 | 49 | } 50 | 51 | public function update(Request $request, $id) 52 | { 53 | $candidate = Candidate::find($id); 54 | 55 | if (!$candidate) { 56 | return ApiResponse::error('Candidate not found'); 57 | 58 | } 59 | 60 | $validatedData = $request->validate([ 61 | 'user_id' => 'required|exists:users,id', 62 | 'job_offer_id' => 'required|exists:job_offers,id', 63 | 'resume_path' => 'nullable|string|max:255', 64 | 'status' => 'required|string|max:50', 65 | 'submitted_at' => 'required|date', 66 | 'last_status_change' => 'nullable|date', 67 | ]); 68 | 69 | $candidate->update($validatedData); 70 | 71 | return ApiResponse::success($candidate, 'Candidate updated successfully!'); 72 | 73 | 74 | } 75 | 76 | public function destroy($id) 77 | { 78 | $candidate = Candidate::find($id); 79 | 80 | if (!$candidate) { 81 | return ApiResponse::error('Candidate not found'); 82 | 83 | } 84 | 85 | $candidate->delete(); 86 | 87 | 88 | return ApiResponse::success($candidate,'Candidate deleted successfully'); 89 | 90 | } 91 | 92 | 93 | } 94 | -------------------------------------------------------------------------------- /config/passport.php: -------------------------------------------------------------------------------- 1 | 'api', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Encryption Keys 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Passport uses encryption keys while generating secure access tokens for 24 | | your application. By default, the keys are stored as local files but 25 | | can be set via environment variables when that is more convenient. 26 | | 27 | */ 28 | 29 | 'private_key' => env('PASSPORT_PRIVATE_KEY'), 30 | 31 | 'public_key' => env('PASSPORT_PUBLIC_KEY'), 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Passport Database Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | By default, Passport's models will utilize your application's default 39 | | database connection. If you wish to use a different connection you 40 | | may specify the configured name of the database connection here. 41 | | 42 | */ 43 | 44 | 'connection' => env('PASSPORT_CONNECTION'), 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Client UUIDs 49 | |-------------------------------------------------------------------------- 50 | | 51 | | By default, Passport uses auto-incrementing primary keys when assigning 52 | | IDs to clients. However, if Passport is installed using the provided 53 | | --uuids switch, this will be set to "true" and UUIDs will be used. 54 | | 55 | */ 56 | 57 | 'client_uuids' => false, 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Personal Access Client 62 | |-------------------------------------------------------------------------- 63 | | 64 | | If you enable client hashing, you should set the personal access client 65 | | ID and unhashed secret within your environment file. The values will 66 | | get used while issuing fresh personal access tokens to your users. 67 | | 68 | */ 69 | 70 | 'personal_access_client' => [ 71 | 'id' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_ID'), 72 | 'secret' => env('PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET'), 73 | ], 74 | 75 | ]; 76 | -------------------------------------------------------------------------------- /app/Http/Controllers/JobOfferController.php: -------------------------------------------------------------------------------- 1 | find($id); 23 | 24 | 25 | if (!$jobOffer) { 26 | return ApiResponse::error(null, 'Job offer not found', 404); 27 | } 28 | 29 | 30 | return ApiResponse::success($jobOffer, 'Job offer retrieved successfully'); 31 | } 32 | 33 | public function store(Request $request) 34 | { 35 | $validatedData = $request->validate([ 36 | 'title' => 'required|string|max:255', 37 | 'department_id' => 'required|exists:departments,id', 38 | 'location' => 'required|string|max:255', 39 | 'min_experience' => 'nullable|integer', 40 | 'max_experience' => 'nullable|integer', 41 | 'tags' => 'nullable|array', 42 | 'short_description' => 'string', 43 | 'requirements' => 'string', 44 | 'expire_at' => 'nullable|string', 45 | 'status' => 'required|string|in:open,closed', 46 | ]); 47 | $validatedData['slug'] = Str::slug($validatedData['title']); 48 | 49 | $jobOffer = JobOffer::create($validatedData); 50 | 51 | return ApiResponse::success($jobOffer, 'Job offer created successfully!'); 52 | } 53 | 54 | 55 | 56 | 57 | 58 | 59 | public function update(Request $request, $id) 60 | { 61 | $jobOffer = JobOffer::find($id); 62 | 63 | if (!$jobOffer) { 64 | return ApiResponse::error('Job offer not found '); 65 | } 66 | 67 | $validatedData = $request->validate([ 68 | 'title' => 'sometimes|required|string|max:255', 69 | 'description' => 'sometimes|required|string', 70 | 'requirements' => 'nullable|string', 71 | 'posting_date' => 'sometimes|required|date', 72 | 'status' => 'sometimes|required|string|max:50', 73 | ]); 74 | 75 | $jobOffer->update($validatedData); 76 | 77 | 78 | return ApiResponse::success($jobOffer, 'Job offer updated successfully!'); 79 | } 80 | 81 | public function destroy($id) 82 | { 83 | $jobOffer = JobOffer::find($id); 84 | 85 | if (!$jobOffer) { 86 | return ApiResponse::error('Job offer not found '); 87 | } 88 | 89 | $jobOffer->delete(); 90 | 91 | 92 | 93 | return ApiResponse::success($jobOffer, 'Job offer deleted successfully!'); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | \Illuminate\Routing\Middleware\ThrottleRequests::class.':api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | protected $routeMiddleware = [ 49 | // Other middleware 50 | 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 51 | ]; 52 | /** 53 | * The application's middleware aliases. 54 | * 55 | * Aliases may be used instead of class names to conveniently assign middleware to routes and groups. 56 | * 57 | * @var array 58 | */ 59 | protected $middlewareAliases = [ 60 | 'auth' => \App\Http\Middleware\Authenticate::class, 61 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 62 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 63 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 64 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 65 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 66 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 67 | 'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class, 68 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 69 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 70 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 71 | ]; 72 | } 73 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. This will override any values set in the token's 45 | | "expires_at" attribute, but first-party sessions are not affected. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Token Prefix 54 | |-------------------------------------------------------------------------- 55 | | 56 | | Sanctum can prefix new tokens in order to take advantage of numerous 57 | | security scanning initiatives maintained by open source platforms 58 | | that notify developers if they commit tokens into repositories. 59 | | 60 | | See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning 61 | | 62 | */ 63 | 64 | 'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Sanctum Middleware 69 | |-------------------------------------------------------------------------- 70 | | 71 | | When authenticating your first-party SPA with Sanctum you may need to 72 | | customize some of the middleware Sanctum uses while processing the 73 | | request. You may change the middleware listed below as required. 74 | | 75 | */ 76 | 77 | 'middleware' => [ 78 | 'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, 79 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 80 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 81 | ], 82 | 83 | ]; 84 | -------------------------------------------------------------------------------- /resources/views/vendor/passport/authorize.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{ config('app.name') }} - Authorization 9 | 10 | 11 | 12 | 13 | 39 | 40 | 41 |
42 |
43 |
44 |
45 |
46 | Authorization Request 47 |
48 |
49 | 50 |

{{ $client->name }} is requesting permission to access your account.

51 | 52 | 53 | @if (count($scopes) > 0) 54 |
55 |

This application will be able to:

56 | 57 |
    58 | @foreach ($scopes as $scope) 59 |
  • {{ $scope->description }}
  • 60 | @endforeach 61 |
62 |
63 | @endif 64 | 65 |
66 | 67 |
68 | @csrf 69 | 70 | 71 | 72 | 73 | 74 |
75 | 76 | 77 |
78 | @csrf 79 | @method('DELETE') 80 | 81 | 82 | 83 | 84 | 85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | 93 | 94 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | 'lock_path' => storage_path('framework/cache/data'), 56 | ], 57 | 58 | 'memcached' => [ 59 | 'driver' => 'memcached', 60 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 61 | 'sasl' => [ 62 | env('MEMCACHED_USERNAME'), 63 | env('MEMCACHED_PASSWORD'), 64 | ], 65 | 'options' => [ 66 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 67 | ], 68 | 'servers' => [ 69 | [ 70 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 71 | 'port' => env('MEMCACHED_PORT', 11211), 72 | 'weight' => 100, 73 | ], 74 | ], 75 | ], 76 | 77 | 'redis' => [ 78 | 'driver' => 'redis', 79 | 'connection' => 'cache', 80 | 'lock_connection' => 'default', 81 | ], 82 | 83 | 'dynamodb' => [ 84 | 'driver' => 'dynamodb', 85 | 'key' => env('AWS_ACCESS_KEY_ID'), 86 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 87 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 88 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 89 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 90 | ], 91 | 92 | 'octane' => [ 93 | 'driver' => 'octane', 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Cache Key Prefix 101 | |-------------------------------------------------------------------------- 102 | | 103 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 104 | | stores there might be other applications using the same cache. For 105 | | that reason, you may prefix every cache key to avoid collisions. 106 | | 107 | */ 108 | 109 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Job Batching 79 | |-------------------------------------------------------------------------- 80 | | 81 | | The following options configure the database and table that store job 82 | | batching information. These options can be updated to any database 83 | | connection and table which has been defined by your application. 84 | | 85 | */ 86 | 87 | 'batching' => [ 88 | 'database' => env('DB_CONNECTION', 'mysql'), 89 | 'table' => 'job_batches', 90 | ], 91 | 92 | /* 93 | |-------------------------------------------------------------------------- 94 | | Failed Queue Jobs 95 | |-------------------------------------------------------------------------- 96 | | 97 | | These options configure the behavior of failed queue job logging so you 98 | | can control which database and table are used to store the jobs that 99 | | have failed. You may change them to any database / table you wish. 100 | | 101 | */ 102 | 103 | 'failed' => [ 104 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 105 | 'database' => env('DB_CONNECTION', 'mysql'), 106 | 'table' => 'failed_jobs', 107 | ], 108 | 109 | ]; 110 | -------------------------------------------------------------------------------- /app/Http/Controllers/UserController.php: -------------------------------------------------------------------------------- 1 | getMessage()); 23 | 24 | return ApiResponse::error('Une erreur est survenue lors de la récupération des utilisateurs.'); 25 | } 26 | } 27 | 28 | 29 | public function store(Request $request) 30 | { 31 | $validator = Validator::make($request->all(), [ 32 | 'name' => 'required|string|max:255', 33 | 'email' => 'required|string|email|max:255|unique:users', 34 | 'role' => 'required|string', 35 | 'password' => 'required|string|min:8|confirmed', 36 | ]); 37 | 38 | 39 | if ($validator->fails()) { 40 | return ApiResponse::error(' erreur ', $validator->errors()); 41 | } 42 | 43 | $user = User::create([ 44 | 'name' => $request->input('name'), 45 | 'email' => $request->input('email'), 46 | 'role' => $request->input('role'), 47 | 'password' => Hash::make($request->input('password')), 48 | ]); 49 | return ApiResponse::success($user, 'Utilisateur créé avec succès'); 50 | } 51 | 52 | 53 | 54 | public function show(string $id) 55 | { 56 | $user = User::find($id); 57 | 58 | if (!$user) { 59 | 60 | 61 | return ApiResponse::error('error', 'Utilisateur non trouvé'); 62 | } 63 | 64 | return ApiResponse::success($user, 'success'); 65 | } 66 | 67 | 68 | public function update(Request $request, $id) 69 | { 70 | 71 | $user = User::find($id); 72 | 73 | if (!$user) { 74 | 75 | return ApiResponse::error('error', 'Utilisateur non trouvé'); 76 | } 77 | 78 | 79 | $validator = Validator::make($request->all(), [ 80 | 'name' => 'sometimes|required|string|max:255', 81 | 'email' => 'sometimes|required|string|email|max:255|unique:users,email,' . $id, 82 | 'role' => 'sometimes|required|string', 83 | 'password' => 'sometimes|required|string|min:8|confirmed', 84 | ]); 85 | 86 | 87 | if ($validator->fails()) { 88 | 89 | 90 | return ApiResponse::error('error', $validator->errors()); 91 | } 92 | 93 | 94 | $user->name = $request->input('name', $user->name); 95 | $user->email = $request->input('email', $user->email); 96 | $user->role = $request->input('role', $user->role); 97 | 98 | 99 | if ($request->has('password')) { 100 | $user->password = Hash::make($request->input('password')); 101 | } 102 | 103 | $user->save(); 104 | 105 | 106 | return ApiResponse::success($user, 'Utilisateur mis à jour avec succès'); 107 | } 108 | 109 | 110 | public function destroy(string $id) 111 | { 112 | try { 113 | $user = User::findOrFail($id); 114 | 115 | $user->delete(); 116 | return ApiResponse::success(null, 'Utilisateur supprimé avec succès'); 117 | } catch (ModelNotFoundException $e) { 118 | 119 | return ApiResponse::error('Utilisateur non trouvé.'); 120 | } catch (\Exception $e) { 121 | Log::error('Erreur lors de la suppression de l\'utilisateur : ' . $e->getMessage()); 122 | 123 | return ApiResponse::error('Une erreur est survenue lors de la suppression de l\'utilisateur.'); 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Laravel Logo

2 | 3 |

4 | Build Status 5 | Total Downloads 6 | Latest Stable Version 7 | License 8 |

9 | 10 | ## About Laravel 11 | 12 | Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: 13 | 14 | - [Simple, fast routing engine](https://laravel.com/docs/routing). 15 | - [Powerful dependency injection container](https://laravel.com/docs/container). 16 | - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. 17 | - Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). 18 | - Database agnostic [schema migrations](https://laravel.com/docs/migrations). 19 | - [Robust background job processing](https://laravel.com/docs/queues). 20 | - [Real-time event broadcasting](https://laravel.com/docs/broadcasting). 21 | 22 | Laravel is accessible, powerful, and provides tools required for large, robust applications. 23 | 24 | ## Learning Laravel 25 | 26 | Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. 27 | 28 | You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. 29 | 30 | If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. 31 | 32 | ## Laravel Sponsors 33 | 34 | We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com). 35 | 36 | ### Premium Partners 37 | 38 | - **[Vehikl](https://vehikl.com/)** 39 | - **[Tighten Co.](https://tighten.co)** 40 | - **[WebReinvent](https://webreinvent.com/)** 41 | - **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** 42 | - **[64 Robots](https://64robots.com)** 43 | - **[Curotec](https://www.curotec.com/services/technologies/laravel/)** 44 | - **[Cyber-Duck](https://cyber-duck.co.uk)** 45 | - **[DevSquad](https://devsquad.com/hire-laravel-developers)** 46 | - **[Jump24](https://jump24.co.uk)** 47 | - **[Redberry](https://redberry.international/laravel/)** 48 | - **[Active Logic](https://activelogic.com)** 49 | - **[byte5](https://byte5.de)** 50 | - **[OP.GG](https://op.gg)** 51 | 52 | ## Contributing 53 | 54 | Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). 55 | 56 | ## Code of Conduct 57 | 58 | In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). 59 | 60 | ## Security Vulnerabilities 61 | 62 | If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. 63 | 64 | ## License 65 | 66 | The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 67 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'api', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 'api' => [ 44 | 'driver' => 'passport', 45 | 'provider' => 'users', 46 | ], 47 | ], 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | User Providers 52 | |-------------------------------------------------------------------------- 53 | | 54 | | All authentication drivers have a user provider. This defines how the 55 | | users are actually retrieved out of your database or other storage 56 | | mechanisms used by this application to persist your user's data. 57 | | 58 | | If you have multiple user tables or models you may configure multiple 59 | | sources which represent each model / table. These sources may then 60 | | be assigned to any extra authentication guards you have defined. 61 | | 62 | | Supported: "database", "eloquent" 63 | | 64 | */ 65 | 66 | 'providers' => [ 67 | 'users' => [ 68 | 'driver' => 'eloquent', 69 | 'model' => App\Models\User::class, 70 | ], 71 | 72 | // 'users' => [ 73 | // 'driver' => 'database', 74 | // 'table' => 'users', 75 | // ], 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Resetting Passwords 81 | |-------------------------------------------------------------------------- 82 | | 83 | | You may specify multiple password reset configurations if you have more 84 | | than one user table or model in the application and you want to have 85 | | separate password reset settings based on the specific user types. 86 | | 87 | | The expiry time is the number of minutes that each reset token will be 88 | | considered valid. This security feature keeps tokens short-lived so 89 | | they have less time to be guessed. You may change this as needed. 90 | | 91 | | The throttle setting is the number of seconds a user must wait before 92 | | generating more password reset tokens. This prevents the user from 93 | | quickly generating a very large amount of password reset tokens. 94 | | 95 | */ 96 | 97 | 'passwords' => [ 98 | 'users' => [ 99 | 'provider' => 'users', 100 | 'table' => 'password_reset_tokens', 101 | 'expire' => 60, 102 | 'throttle' => 60, 103 | ], 104 | ], 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Password Confirmation Timeout 109 | |-------------------------------------------------------------------------- 110 | | 111 | | Here you may define the amount of seconds before a password confirmation 112 | | times out and the user is prompted to re-enter their password via the 113 | | confirmation screen. By default, the timeout lasts for three hours. 114 | | 115 | */ 116 | 117 | 'password_timeout' => 10800, 118 | 119 | ]; 120 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", 32 | | "postmark", "log", "array", "failover", "roundrobin" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'url' => env('MAIL_URL'), 40 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 41 | 'port' => env('MAIL_PORT', 587), 42 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 43 | 'username' => env('MAIL_USERNAME'), 44 | 'password' => env('MAIL_PASSWORD'), 45 | 'timeout' => null, 46 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 47 | ], 48 | 49 | 'ses' => [ 50 | 'transport' => 'ses', 51 | ], 52 | 53 | 'postmark' => [ 54 | 'transport' => 'postmark', 55 | // 'message_stream_id' => null, 56 | // 'client' => [ 57 | // 'timeout' => 5, 58 | // ], 59 | ], 60 | 61 | 'mailgun' => [ 62 | 'transport' => 'mailgun', 63 | // 'client' => [ 64 | // 'timeout' => 5, 65 | // ], 66 | ], 67 | 68 | 'sendmail' => [ 69 | 'transport' => 'sendmail', 70 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 71 | ], 72 | 73 | 'log' => [ 74 | 'transport' => 'log', 75 | 'channel' => env('MAIL_LOG_CHANNEL'), 76 | ], 77 | 78 | 'array' => [ 79 | 'transport' => 'array', 80 | ], 81 | 82 | 'failover' => [ 83 | 'transport' => 'failover', 84 | 'mailers' => [ 85 | 'smtp', 86 | 'log', 87 | ], 88 | ], 89 | 90 | 'roundrobin' => [ 91 | 'transport' => 'roundrobin', 92 | 'mailers' => [ 93 | 'ses', 94 | 'postmark', 95 | ], 96 | ], 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Global "From" Address 102 | |-------------------------------------------------------------------------- 103 | | 104 | | You may wish for all e-mails sent by your application to be sent from 105 | | the same address. Here, you may specify a name and address that is 106 | | used globally for all e-mails that are sent by your application. 107 | | 108 | */ 109 | 110 | 'from' => [ 111 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 112 | 'name' => env('MAIL_FROM_NAME', 'Example'), 113 | ], 114 | 115 | /* 116 | |-------------------------------------------------------------------------- 117 | | Markdown Mail Settings 118 | |-------------------------------------------------------------------------- 119 | | 120 | | If you are using Markdown based email rendering, you may configure your 121 | | theme and component paths here, allowing you to customize the design 122 | | of the emails. Or, you may simply stick with the Laravel defaults! 123 | | 124 | */ 125 | 126 | 'markdown' => [ 127 | 'theme' => 'default', 128 | 129 | 'paths' => [ 130 | resource_path('views/vendor/mail'), 131 | ], 132 | ], 133 | 134 | ]; 135 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Deprecations Log Channel 26 | |-------------------------------------------------------------------------- 27 | | 28 | | This option controls the log channel that should be used to log warnings 29 | | regarding deprecated PHP and library features. This allows you to get 30 | | your application ready for upcoming major versions of dependencies. 31 | | 32 | */ 33 | 34 | 'deprecations' => [ 35 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 36 | 'trace' => false, 37 | ], 38 | 39 | /* 40 | |-------------------------------------------------------------------------- 41 | | Log Channels 42 | |-------------------------------------------------------------------------- 43 | | 44 | | Here you may configure the log channels for your application. Out of 45 | | the box, Laravel uses the Monolog PHP logging library. This gives 46 | | you a variety of powerful log handlers / formatters to utilize. 47 | | 48 | | Available Drivers: "single", "daily", "slack", "syslog", 49 | | "errorlog", "monolog", 50 | | "custom", "stack" 51 | | 52 | */ 53 | 54 | 'channels' => [ 55 | 'stack' => [ 56 | 'driver' => 'stack', 57 | 'channels' => ['single'], 58 | 'ignore_exceptions' => false, 59 | ], 60 | 61 | 'single' => [ 62 | 'driver' => 'single', 63 | 'path' => storage_path('logs/laravel.log'), 64 | 'level' => env('LOG_LEVEL', 'debug'), 65 | 'replace_placeholders' => true, 66 | ], 67 | 68 | 'daily' => [ 69 | 'driver' => 'daily', 70 | 'path' => storage_path('logs/laravel.log'), 71 | 'level' => env('LOG_LEVEL', 'debug'), 72 | 'days' => 14, 73 | 'replace_placeholders' => true, 74 | ], 75 | 76 | 'slack' => [ 77 | 'driver' => 'slack', 78 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 79 | 'username' => 'Laravel Log', 80 | 'emoji' => ':boom:', 81 | 'level' => env('LOG_LEVEL', 'critical'), 82 | 'replace_placeholders' => true, 83 | ], 84 | 85 | 'papertrail' => [ 86 | 'driver' => 'monolog', 87 | 'level' => env('LOG_LEVEL', 'debug'), 88 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 89 | 'handler_with' => [ 90 | 'host' => env('PAPERTRAIL_URL'), 91 | 'port' => env('PAPERTRAIL_PORT'), 92 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 93 | ], 94 | 'processors' => [PsrLogMessageProcessor::class], 95 | ], 96 | 97 | 'stderr' => [ 98 | 'driver' => 'monolog', 99 | 'level' => env('LOG_LEVEL', 'debug'), 100 | 'handler' => StreamHandler::class, 101 | 'formatter' => env('LOG_STDERR_FORMATTER'), 102 | 'with' => [ 103 | 'stream' => 'php://stderr', 104 | ], 105 | 'processors' => [PsrLogMessageProcessor::class], 106 | ], 107 | 108 | 'syslog' => [ 109 | 'driver' => 'syslog', 110 | 'level' => env('LOG_LEVEL', 'debug'), 111 | 'facility' => LOG_USER, 112 | 'replace_placeholders' => true, 113 | ], 114 | 115 | 'errorlog' => [ 116 | 'driver' => 'errorlog', 117 | 'level' => env('LOG_LEVEL', 'debug'), 118 | 'replace_placeholders' => true, 119 | ], 120 | 121 | 'null' => [ 122 | 'driver' => 'monolog', 123 | 'handler' => NullHandler::class, 124 | ], 125 | 126 | 'emergency' => [ 127 | 'path' => storage_path('logs/laravel.log'), 128 | ], 129 | ], 130 | 131 | ]; 132 | -------------------------------------------------------------------------------- /app/Http/Controllers/EmployeeController.php: -------------------------------------------------------------------------------- 1 | get(); 22 | 23 | 24 | return ApiResponse::success($employees, 'success '); 25 | } 26 | 27 | 28 | 29 | 30 | 31 | public function store(Request $request) 32 | { 33 | $validatedData = $request->validate([ 34 | 35 | 'name' => 'required|string', 36 | 'last_name' => 'required|string', 37 | 'email' => 'required|email', 38 | 'phone' => 'required|string', 39 | 'birthday' => 'required|string', 40 | 'sexe' => 'required|in:h,f', 41 | 'avatar' => 'nullable', 42 | 43 | 'department_id' => 'required|numeric', 44 | 'position_id' => 'required|numeric', 45 | 'supervisor_id' => 'nullable|numeric', 46 | /* 'shift_id' => 'required|numeric', */ 47 | 'hire_date' => 'required|string', 48 | /* 'contract_type_id' => 'required|numeric', */ 49 | 'end_contract' => 'nullable|string', 50 | 'additional_infos' => 'nullable|array', 51 | 'additional_infos.contactName' => 'nullable|string', 52 | 'additional_infos.contactRelation' => 'nullable|string', 53 | 'additional_infos.contactPhone' => 'nullable|string', 54 | 'additional_infos.maritalStatus' => 'nullable|string', 55 | 'additional_infos.bloodGroup' => 'nullable|string', 56 | ]); 57 | 58 | $user = User::create([ 59 | 'name' => $validatedData['name'] . ' ' . $validatedData['last_name'], 60 | 'email' => $validatedData['email'], 61 | 'role' => 'employee', 62 | 'password' => Hash::make('test1234'), 63 | ]); 64 | 65 | $employee = Employee::create(array_merge($validatedData, [ 66 | 'user_id' => $user->id, 67 | 'shift_id' =>1, 68 | 'contract_type_id' =>1, 69 | ])); 70 | 71 | 72 | return ApiResponse::success($employee, 'Employee created successfully!'); 73 | 74 | } 75 | 76 | 77 | 78 | //////////////////////// 79 | 80 | 81 | 82 | 83 | 84 | 85 | public function getAllEmployees(Request $request): jsonResponse 86 | { 87 | 88 | try { 89 | $employees = Employee::all(); 90 | 91 | if ($employees->isEmpty()) { 92 | return ApiResponse::success([], 'No employees found.'); 93 | } 94 | return ApiResponse::success($employees, 'success'); 95 | 96 | 97 | } catch (\Exception $e) { 98 | return ApiResponse::error("Failed", $e->getMessage()); 99 | 100 | } 101 | } 102 | 103 | 104 | 105 | 106 | 107 | 108 | public function show(string $id) 109 | { 110 | $employee = Employee::with(['user', 'department'])->find($id); 111 | 112 | if (!$employee) { 113 | return response()->json([ 114 | 'status' => 'error', 115 | 'message' => 'Employee not found' 116 | ], 404); 117 | } 118 | 119 | return response()->json($employee); 120 | } 121 | 122 | 123 | public function update(Request $request, string $id) 124 | { 125 | $employee = Employee::find($id); 126 | 127 | if (!$employee) { 128 | return response()->json([ 129 | 'status' => 'error', 130 | 'message' => 'Employee not found' 131 | ], 404); 132 | } 133 | 134 | $validator = Validator::make($request->all(), [ 135 | 'user_id' => 'sometimes|exists:users,id', 136 | 'hire_date' => 'sometimes|date', 137 | 'contract_type' => 'sometimes|string', 138 | 'department_id' => 'sometimes|exists:departments,id', 139 | 'position' => 'sometimes|string', 140 | ]); 141 | 142 | if ($validator->fails()) { 143 | return response()->json([ 144 | 'status' => 'error', 145 | 'messages' => $validator->errors() 146 | ], 422); 147 | } 148 | 149 | $employee->update($request->all()); 150 | 151 | return response()->json([ 152 | 'status' => 'success', 153 | 'message' => 'Employee updated successfully', 154 | 'employee' => $employee 155 | ]); 156 | } 157 | 158 | public function destroy(string $id) 159 | { 160 | $employee = Employee::find($id); 161 | 162 | if (!$employee) { 163 | return response()->json([ 164 | 'status' => 'error', 165 | 'message' => 'Employee not found' 166 | ], 404); 167 | } 168 | 169 | $employee->delete(); 170 | 171 | return response()->json([ 172 | 'status' => 'success', 173 | 'message' => 'Employee deleted successfully' 174 | ]); 175 | } 176 | 177 | } 178 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'search_path' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 93 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Migration Repository Table 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This table keeps track of all the migrations that have already run for 104 | | your application. Using this information, we can determine which of 105 | | the migrations on disk haven't actually been run in the database. 106 | | 107 | */ 108 | 109 | 'migrations' => 'migrations', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Redis Databases 114 | |-------------------------------------------------------------------------- 115 | | 116 | | Redis is an open source, fast, and advanced key-value store that also 117 | | provides a richer body of commands than a typical key-value system 118 | | such as APC or Memcached. Laravel makes it easy to dig right in. 119 | | 120 | */ 121 | 122 | 'redis' => [ 123 | 124 | 'client' => env('REDIS_CLIENT', 'phpredis'), 125 | 126 | 'options' => [ 127 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 128 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 129 | ], 130 | 131 | 'default' => [ 132 | 'url' => env('REDIS_URL'), 133 | 'host' => env('REDIS_HOST', '127.0.0.1'), 134 | 'username' => env('REDIS_USERNAME'), 135 | 'password' => env('REDIS_PASSWORD'), 136 | 'port' => env('REDIS_PORT', '6379'), 137 | 'database' => env('REDIS_DB', '0'), 138 | ], 139 | 140 | 'cache' => [ 141 | 'url' => env('REDIS_URL'), 142 | 'host' => env('REDIS_HOST', '127.0.0.1'), 143 | 'username' => env('REDIS_USERNAME'), 144 | 'password' => env('REDIS_PASSWORD'), 145 | 'port' => env('REDIS_PORT', '6379'), 146 | 'database' => env('REDIS_CACHE_DB', '1'), 147 | ], 148 | 149 | ], 150 | 151 | ]; 152 | -------------------------------------------------------------------------------- /resources/views/vendor/l5-swagger/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{config('l5-swagger.documentations.'.$documentation.'.api.title')}} 6 | 7 | 8 | 9 | 28 | @if(config('l5-swagger.defaults.ui.display.dark_mode')) 29 | 113 | @endif 114 | 115 | 116 | 117 |
118 | 119 | 120 | 121 | 163 | 164 | 165 | -------------------------------------------------------------------------------- /config/app.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'Laravel'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Application Environment 24 | |-------------------------------------------------------------------------- 25 | | 26 | | This value determines the "environment" your application is currently 27 | | running in. This may determine how you prefer to configure various 28 | | services the application utilizes. Set this in your ".env" file. 29 | | 30 | */ 31 | 32 | 'env' => env('APP_ENV', 'production'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Application Debug Mode 37 | |-------------------------------------------------------------------------- 38 | | 39 | | When your application is in debug mode, detailed error messages with 40 | | stack traces will be shown on every error that occurs within your 41 | | application. If disabled, a simple generic error page is shown. 42 | | 43 | */ 44 | 45 | 'debug' => (bool) env('APP_DEBUG', false), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Application URL 50 | |-------------------------------------------------------------------------- 51 | | 52 | | This URL is used by the console to properly generate URLs when using 53 | | the Artisan command line tool. You should set this to the root of 54 | | your application so that it is used when running Artisan tasks. 55 | | 56 | */ 57 | 58 | 'url' => env('APP_URL', 'http://localhost'), 59 | 60 | 'asset_url' => env('ASSET_URL'), 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Application Timezone 65 | |-------------------------------------------------------------------------- 66 | | 67 | | Here you may specify the default timezone for your application, which 68 | | will be used by the PHP date and date-time functions. We have gone 69 | | ahead and set this to a sensible default for you out of the box. 70 | | 71 | */ 72 | 73 | 'timezone' => 'UTC', 74 | 75 | /* 76 | |-------------------------------------------------------------------------- 77 | | Application Locale Configuration 78 | |-------------------------------------------------------------------------- 79 | | 80 | | The application locale determines the default locale that will be used 81 | | by the translation service provider. You are free to set this value 82 | | to any of the locales which will be supported by the application. 83 | | 84 | */ 85 | 86 | 'locale' => 'en', 87 | 88 | /* 89 | |-------------------------------------------------------------------------- 90 | | Application Fallback Locale 91 | |-------------------------------------------------------------------------- 92 | | 93 | | The fallback locale determines the locale to use when the current one 94 | | is not available. You may change the value to correspond to any of 95 | | the language folders that are provided through your application. 96 | | 97 | */ 98 | 99 | 'fallback_locale' => 'en', 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Faker Locale 104 | |-------------------------------------------------------------------------- 105 | | 106 | | This locale will be used by the Faker PHP library when generating fake 107 | | data for your database seeds. For example, this will be used to get 108 | | localized telephone numbers, street address information and more. 109 | | 110 | */ 111 | 112 | 'faker_locale' => 'en_US', 113 | 114 | /* 115 | |-------------------------------------------------------------------------- 116 | | Encryption Key 117 | |-------------------------------------------------------------------------- 118 | | 119 | | This key is used by the Illuminate encrypter service and should be set 120 | | to a random, 32 character string, otherwise these encrypted strings 121 | | will not be safe. Please do this before deploying an application! 122 | | 123 | */ 124 | 125 | 'key' => env('APP_KEY'), 126 | 127 | 'cipher' => 'AES-256-CBC', 128 | 129 | /* 130 | |-------------------------------------------------------------------------- 131 | | Maintenance Mode Driver 132 | |-------------------------------------------------------------------------- 133 | | 134 | | These configuration options determine the driver used to determine and 135 | | manage Laravel's "maintenance mode" status. The "cache" driver will 136 | | allow maintenance mode to be controlled across multiple machines. 137 | | 138 | | Supported drivers: "file", "cache" 139 | | 140 | */ 141 | 142 | 'maintenance' => [ 143 | 'driver' => 'file', 144 | // 'store' => 'redis', 145 | ], 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Autoloaded Service Providers 150 | |-------------------------------------------------------------------------- 151 | | 152 | | The service providers listed here will be automatically loaded on the 153 | | request to your application. Feel free to add your own services to 154 | | this array to grant expanded functionality to your applications. 155 | | 156 | */ 157 | 158 | 'providers' => ServiceProvider::defaultProviders()->merge([ 159 | /* 160 | * Package Service Providers... 161 | */ 162 | 163 | /* 164 | * Application Service Providers... 165 | */ 166 | App\Providers\AppServiceProvider::class, 167 | App\Providers\AuthServiceProvider::class, 168 | // App\Providers\BroadcastServiceProvider::class, 169 | App\Providers\EventServiceProvider::class, 170 | App\Providers\RouteServiceProvider::class, 171 | Laravel\Passport\PassportServiceProvider::class, 172 | ])->toArray(), 173 | 174 | /* 175 | |-------------------------------------------------------------------------- 176 | | Class Aliases 177 | |-------------------------------------------------------------------------- 178 | | 179 | | This array of class aliases will be registered when this application 180 | | is started. However, feel free to register as many as you wish as 181 | | the aliases are "lazy" loaded so they don't hinder performance. 182 | | 183 | */ 184 | 185 | 'aliases' => Facade::defaultAliases()->merge([ 186 | // 'Example' => App\Facades\Example::class, 187 | ])->toArray(), 188 | 189 | ]; 190 | -------------------------------------------------------------------------------- /config/session.php: -------------------------------------------------------------------------------- 1 | env('SESSION_DRIVER', 'file'), 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Session Lifetime 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Here you may specify the number of minutes that you wish the session 29 | | to be allowed to remain idle before it expires. If you want them 30 | | to immediately expire on the browser closing, set that option. 31 | | 32 | */ 33 | 34 | 'lifetime' => env('SESSION_LIFETIME', 120), 35 | 36 | 'expire_on_close' => false, 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Session Encryption 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This option allows you to easily specify that all of your session data 44 | | should be encrypted before it is stored. All encryption will be run 45 | | automatically by Laravel and you can use the Session like normal. 46 | | 47 | */ 48 | 49 | 'encrypt' => false, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Session File Location 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When using the native session driver, we need a location where session 57 | | files may be stored. A default has been set for you but a different 58 | | location may be specified. This is only needed for file sessions. 59 | | 60 | */ 61 | 62 | 'files' => storage_path('framework/sessions'), 63 | 64 | /* 65 | |-------------------------------------------------------------------------- 66 | | Session Database Connection 67 | |-------------------------------------------------------------------------- 68 | | 69 | | When using the "database" or "redis" session drivers, you may specify a 70 | | connection that should be used to manage these sessions. This should 71 | | correspond to a connection in your database configuration options. 72 | | 73 | */ 74 | 75 | 'connection' => env('SESSION_CONNECTION'), 76 | 77 | /* 78 | |-------------------------------------------------------------------------- 79 | | Session Database Table 80 | |-------------------------------------------------------------------------- 81 | | 82 | | When using the "database" session driver, you may specify the table we 83 | | should use to manage the sessions. Of course, a sensible default is 84 | | provided for you; however, you are free to change this as needed. 85 | | 86 | */ 87 | 88 | 'table' => 'sessions', 89 | 90 | /* 91 | |-------------------------------------------------------------------------- 92 | | Session Cache Store 93 | |-------------------------------------------------------------------------- 94 | | 95 | | While using one of the framework's cache driven session backends you may 96 | | list a cache store that should be used for these sessions. This value 97 | | must match with one of the application's configured cache "stores". 98 | | 99 | | Affects: "apc", "dynamodb", "memcached", "redis" 100 | | 101 | */ 102 | 103 | 'store' => env('SESSION_STORE'), 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Session Sweeping Lottery 108 | |-------------------------------------------------------------------------- 109 | | 110 | | Some session drivers must manually sweep their storage location to get 111 | | rid of old sessions from storage. Here are the chances that it will 112 | | happen on a given request. By default, the odds are 2 out of 100. 113 | | 114 | */ 115 | 116 | 'lottery' => [2, 100], 117 | 118 | /* 119 | |-------------------------------------------------------------------------- 120 | | Session Cookie Name 121 | |-------------------------------------------------------------------------- 122 | | 123 | | Here you may change the name of the cookie used to identify a session 124 | | instance by ID. The name specified here will get used every time a 125 | | new session cookie is created by the framework for every driver. 126 | | 127 | */ 128 | 129 | 'cookie' => env( 130 | 'SESSION_COOKIE', 131 | Str::slug(env('APP_NAME', 'laravel'), '_').'_session' 132 | ), 133 | 134 | /* 135 | |-------------------------------------------------------------------------- 136 | | Session Cookie Path 137 | |-------------------------------------------------------------------------- 138 | | 139 | | The session cookie path determines the path for which the cookie will 140 | | be regarded as available. Typically, this will be the root path of 141 | | your application but you are free to change this when necessary. 142 | | 143 | */ 144 | 145 | 'path' => '/', 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Session Cookie Domain 150 | |-------------------------------------------------------------------------- 151 | | 152 | | Here you may change the domain of the cookie used to identify a session 153 | | in your application. This will determine which domains the cookie is 154 | | available to in your application. A sensible default has been set. 155 | | 156 | */ 157 | 158 | 'domain' => env('SESSION_DOMAIN'), 159 | 160 | /* 161 | |-------------------------------------------------------------------------- 162 | | HTTPS Only Cookies 163 | |-------------------------------------------------------------------------- 164 | | 165 | | By setting this option to true, session cookies will only be sent back 166 | | to the server if the browser has a HTTPS connection. This will keep 167 | | the cookie from being sent to you when it can't be done securely. 168 | | 169 | */ 170 | 171 | 'secure' => env('SESSION_SECURE_COOKIE'), 172 | 173 | /* 174 | |-------------------------------------------------------------------------- 175 | | HTTP Access Only 176 | |-------------------------------------------------------------------------- 177 | | 178 | | Setting this value to true will prevent JavaScript from accessing the 179 | | value of the cookie and the cookie will only be accessible through 180 | | the HTTP protocol. You are free to modify this option if needed. 181 | | 182 | */ 183 | 184 | 'http_only' => true, 185 | 186 | /* 187 | |-------------------------------------------------------------------------- 188 | | Same-Site Cookies 189 | |-------------------------------------------------------------------------- 190 | | 191 | | This option determines how your cookies behave when cross-site requests 192 | | take place, and can be used to mitigate CSRF attacks. By default, we 193 | | will set this value to "lax" since this is a secure default value. 194 | | 195 | | Supported: "lax", "strict", "none", null 196 | | 197 | */ 198 | 199 | 'same_site' => 'lax', 200 | 201 | /* 202 | |-------------------------------------------------------------------------- 203 | | Partitioned Cookies 204 | |-------------------------------------------------------------------------- 205 | | 206 | | Setting this value to true will tie the cookie to the top-level site for 207 | | a cross-site context. Partitioned cookies are accepted by the browser 208 | | when flagged "secure" and the Same-Site attribute is set to "none". 209 | | 210 | */ 211 | 212 | 'partitioned' => false, 213 | 214 | ]; 215 | --------------------------------------------------------------------------------