-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MPM-8] New API to get usage types & Create Company API & Update Main…
…Settings API (#40) * MPM-8 new api & updates * MPM-8 PSR12 * MPM-8 lint * MPM-8 lint
- Loading branch information
1 parent
2fff160
commit 5114646
Showing
7 changed files
with
104 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Website/htdocs/mpmanager/app/Http/Controllers/UsageTypeController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Resources\ApiResource; | ||
use App\Models\UsageType; | ||
use App\Services\UsageTypeService; | ||
use Illuminate\Http\Request; | ||
|
||
class UsageTypeController extends Controller | ||
{ | ||
public function __construct(private UsageTypeService $usageTypeService) | ||
{ | ||
} | ||
|
||
public function index(Request $request): ApiResource | ||
{ | ||
return ApiResource::make($this->usageTypeService->getAll()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
Website/htdocs/mpmanager/app/Services/UsageTypeService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Services; | ||
|
||
use App\Models\UsageType; | ||
|
||
class UsageTypeService implements IBaseService | ||
{ | ||
public function __construct(private UsageType $usageType) | ||
{ | ||
} | ||
|
||
public function getAll($limit = null) | ||
{ | ||
return $this->usageType->newQuery()->get(); | ||
} | ||
|
||
public function getById($id) | ||
{ | ||
// TODO: Implement getById() method. | ||
} | ||
|
||
public function create($data) | ||
{ | ||
// TODO: Implement create() method. | ||
} | ||
|
||
public function update($model, $data) | ||
{ | ||
// TODO: Implement update() method. | ||
} | ||
|
||
public function delete($model) | ||
{ | ||
// TODO: Implement delete() method. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters