forked from admin/services_core
CRUD Ticket Insidace Type
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Ticket;
|
||||
|
||||
use App\Models\TicketIncidentType;
|
||||
|
||||
class TicketIncidentTypeService
|
||||
{
|
||||
public function getAll()
|
||||
{
|
||||
return TicketIncidentType::orderBy('name')->get();
|
||||
}
|
||||
|
||||
public function create(array $data): TicketIncidentType
|
||||
{
|
||||
return TicketIncidentType::create([
|
||||
'name' => $data['name'],
|
||||
'is_active' => $data['is_active'] ?? true
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(
|
||||
TicketIncidentType $ticketIncidentType,
|
||||
array $data
|
||||
): TicketIncidentType {
|
||||
$ticketIncidentType->update([
|
||||
'name' => $data['name'],
|
||||
'is_active' => $data['is_active']
|
||||
]);
|
||||
|
||||
return $ticketIncidentType->fresh();
|
||||
}
|
||||
|
||||
public function delete(TicketIncidentType $ticketIncidentType): void
|
||||
{
|
||||
$ticketIncidentType->delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user