Merge branch 'main' of http://bibgit.com/dharmaraj/New-OMIS into omis_dharma
This commit is contained in:
@ -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');
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
33
app/Service/DepartmentService.php
Normal file
33
app/Service/DepartmentService.php
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user