Merge branch 'main' of http://bibgit.com/dharmaraj/New-OMIS into omis_dharma

This commit is contained in:
2024-04-10 15:22:33 +05:45
14 changed files with 432 additions and 197 deletions

View File

@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Modules\Employee\Models\Employee;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
@ -45,7 +46,8 @@ class User extends Authenticatable
'email_verified_at' => 'datetime',
];
// public function employee(){
// return $this->belongsTo(Employee::class,'employee_id');
// }
public function employee()
{
return $this->hasOne(Employee::class, 'users_id');
}
}

View File

@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@ -20,5 +21,7 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void
{
//
Paginator::useBootstrap();
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace Modules\Department\Repositories;
use Modules\Department\Models\Department;
class DepartmentService
{
public function findAll()
{
return Department::paginate(20);
}
public function getDepartmentById($DepartmentId)
{
return Department::findOrFail($DepartmentId);
}
public function delete($DepartmentId)
{
Department::destroy($DepartmentId);
}
public function create($DepartmentDetails)
{
return Department::create($DepartmentDetails);
}
public function update($DepartmentId, array $newDetails)
{
return Department::whereId($DepartmentId)->update($newDetails);
}
}