Some checks failed
continuous-integration/drone/push Build is failing
- 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
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Repositories\ManagementLink;
|
|
|
|
class ManagementLinkService
|
|
{
|
|
private $managementLinkRepository;
|
|
|
|
public function __construct(ManagementLink $managementLinkRepository)
|
|
{
|
|
$this->managementLinkRepository = $managementLinkRepository;
|
|
}
|
|
|
|
public function save(array $data)
|
|
{
|
|
if (isset($data['id'])) {
|
|
$management_links = $this->managementLinkRepository->findOrFail($data['id']);
|
|
$management_links->update($data);
|
|
} else {
|
|
$management_links = $this->managementLinkRepository->create($data);
|
|
}
|
|
|
|
return $management_links;
|
|
}
|
|
|
|
public function delete($id)
|
|
{
|
|
$management_links = $this->managementLinkRepository->findOrFail($id);
|
|
$management_links->delete();
|
|
}
|
|
|
|
public function get($id)
|
|
{
|
|
return $this->managementLinkRepository->findOrFail($id);
|
|
}
|
|
|
|
public function getAll()
|
|
{
|
|
return $this->managementLinkRepository->all();
|
|
}
|
|
|
|
public function with(array $children)
|
|
{
|
|
return $this->managementLinkRepository->with($children)->get();
|
|
}
|
|
|
|
public function getOneWith($id, array $children)
|
|
{
|
|
return $this->managementLinkRepository->with($children)->findOrFail($id);
|
|
}
|
|
}
|