- Complete GGZ Ecademy Laravel backend application - RESTful API for learning products, members, filters - Authentication and authorization system - Database migrations and seeders - Custom CRUD generator commands - Email notification system - Integration with frontend applications
This commit is contained in:
53
app/Services/ChecklistVersionService.php
Normal file
53
app/Services/ChecklistVersionService.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Repositories\ChecklistVersion;
|
||||
|
||||
class ChecklistVersionService
|
||||
{
|
||||
private $checklistversionRepository;
|
||||
|
||||
public function __construct(ChecklistVersion $checklistversionRepository)
|
||||
{
|
||||
$this->checklistversionRepository = $checklistversionRepository;
|
||||
}
|
||||
|
||||
public function save(array $data)
|
||||
{
|
||||
if (isset($data['id'])) {
|
||||
$checklistversion = $this->checklistversionRepository->findOrFail($data['id']);
|
||||
$checklistversion->update($data);
|
||||
} else {
|
||||
$checklistversion = $this->checklistversionRepository->create($data);
|
||||
}
|
||||
|
||||
return $checklistversion;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$checklistversion = $this->checklistversionRepository->findOrFail($id);
|
||||
$checklistversion->delete();
|
||||
}
|
||||
|
||||
public function get($id)
|
||||
{
|
||||
return $this->checklistversionRepository->findOrFail($id);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return $this->checklistversionRepository->all();
|
||||
}
|
||||
|
||||
public function with(array $children)
|
||||
{
|
||||
return $this->checklistversionRepository->with($children)->get();
|
||||
}
|
||||
|
||||
public function getOneWith($id, array $children)
|
||||
{
|
||||
return $this->checklistversionRepository->with($children)->findOrFail($id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user