- 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/RevisionService.php
Normal file
53
app/Services/RevisionService.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Repositories\Revision;
|
||||
|
||||
class RevisionService
|
||||
{
|
||||
private $revisionRepository;
|
||||
|
||||
public function __construct(Revision $revisionRepository)
|
||||
{
|
||||
$this->revisionRepository = $revisionRepository;
|
||||
}
|
||||
|
||||
public function save(array $data)
|
||||
{
|
||||
if (isset($data['id'])) {
|
||||
$revision = $this->revisionRepository->findOrFail($data['id']);
|
||||
$revision->update($data);
|
||||
} else {
|
||||
$revision = $this->revisionRepository->create($data);
|
||||
}
|
||||
|
||||
return $revision;
|
||||
}
|
||||
|
||||
// public function delete($id)
|
||||
// {
|
||||
// $revision = $this->revisionRepository->findOrFail($id);
|
||||
// $revision->delete();
|
||||
// }
|
||||
|
||||
// public function get($id)
|
||||
// {
|
||||
// return $this->revisionRepository->findOrFail($id);
|
||||
// }
|
||||
|
||||
// public function getAll()
|
||||
// {
|
||||
// return $this->revisionRepository->all();
|
||||
// }
|
||||
|
||||
// public function with(array $children)
|
||||
// {
|
||||
// return $this->revisionRepository->with($children)->get();
|
||||
// }
|
||||
|
||||
// public function getOneWith($id, array $children)
|
||||
// {
|
||||
// return $this->revisionRepository->with($children)->findOrFail($id);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user