-
Notifications
You must be signed in to change notification settings - Fork 0
Mini be #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KiraniaKharisa
wants to merge
15
commits into
main
Choose a base branch
from
mini_be
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Mini be #1
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3d9fe24
fix: register user
elfaaza e69f666
settings
athasyah 317aeae
Feat: Role CRUD
YanceBerlian 06ee0bf
Revamp Fiture Create Outlet
KiraniaKharisa 2cdda01
Revisi : Pull Request Pertama
KiraniaKharisa 442cc61
Revisi : Pull Request 2
KiraniaKharisa 0db6352
Revisi: delete composer.lock from repo
KiraniaKharisa 5690f09
Menambahkan CRUD Unit
KiraniaKharisa c2eb3bd
fix: setting
athasyah 350c5e6
Merge branch 'mini_be' of https://github.com/Hummatech-Indonesia/api-…
athasyah cdbaf86
Menambahkan message di Unit
KiraniaKharisa b2a2c94
Merge pull request #2 from Hummatech-Indonesia/rania_be
KiraniaKharisa fe92158
fix: settingController
athasyah f4d84ac
Update main.yml
wira29 8b9c473
Update .gitignore
wira29 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,40 +1 @@ | ||
| name: CI/CD Development | ||
| on : | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| web-deploy: | ||
| name: auto deploy | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: get latest code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: FTP Deploy | ||
| # You may pin to the exact commit or the version. | ||
| # uses: SamKirkland/FTP-Deploy-Action@8a24039354ee91000cb948cb4a1dbdf1a1b94a3c | ||
| uses: SamKirkland/FTP-Deploy-Action@v4.3.1 | ||
| with: | ||
| # ftp server | ||
| server: ${{ secrets.FTP_SERVER }} | ||
| # ftp username | ||
| username: ${{ secrets.FTP_USERNAME }} | ||
| # ftp password | ||
| password: ${{ secrets.FTP_PASSWORD }} | ||
| # Server port to connect to (read your web hosts docs) | ||
| port: ${{ secrets.FTP_PORT }} | ||
| # protocol to deploy with - ftp, ftps, or ftps-legacy | ||
| protocol: ftp | ||
| # An array of glob patterns, these files will not be included in the publish/delete process | ||
| exclude: | | ||
| **/.git* | ||
| **/.git*/** | ||
| **/node_modules/** | ||
| **/vendor/** | ||
| **/storage/** |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -17,4 +17,6 @@ yarn-error.log | |
| /.fleet | ||
| /.idea | ||
| /.vscode | ||
| /storage | ||
| /storage/framework | ||
| composer.lock | ||
| /.github/** | ||
This file contains hidden or 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 hidden or 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,17 @@ | ||
| <?php | ||
|
|
||
| namespace App\Contracts\Interfaces\Master; | ||
|
|
||
| use App\Contracts\Interfaces\Eloquent\StoreInterface; | ||
| use App\Contracts\Interfaces\Eloquent\GetInterface; | ||
| use App\Contracts\Interfaces\Eloquent\UpdateInterface; | ||
| use App\Contracts\Interfaces\Eloquent\DeleteInterface; | ||
| use App\Contracts\Interfaces\Eloquent\ShowInterface; | ||
|
|
||
| interface RoleInterface extends StoreInterface, GetInterface, UpdateInterface, DeleteInterface, ShowInterface | ||
| { | ||
| public function get(?int $perPage = null): mixed; | ||
|
|
||
| public function restore(mixed $id): mixed; | ||
| } | ||
|
|
This file contains hidden or 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,17 @@ | ||
| <?php | ||
|
|
||
| namespace App\Contracts\Interfaces\Master; | ||
|
|
||
| use App\Contracts\Interfaces\Eloquent\CustomPaginateInterface; | ||
| use App\Contracts\Interfaces\Eloquent\DeleteInterface; | ||
| use App\Contracts\Interfaces\Eloquent\GetInterface; | ||
| use App\Contracts\Interfaces\Eloquent\ShowInterface; | ||
| use App\Contracts\Interfaces\Eloquent\StoreInterface; | ||
| use App\Contracts\Interfaces\Eloquent\UpdateInterface; | ||
|
|
||
| interface UnitInterface extends GetInterface, StoreInterface, CustomPaginateInterface, ShowInterface, UpdateInterface, DeleteInterface | ||
| { | ||
| public function allDataTrashed(): mixed; | ||
|
|
||
| public function all(): mixed; | ||
| } |
This file contains hidden or 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,15 @@ | ||
| <?php | ||
|
|
||
| namespace App\Contracts\Interfaces; | ||
|
|
||
| use App\Contracts\Interfaces\Eloquent\CustomPaginateInterface; | ||
| use App\Contracts\Interfaces\Eloquent\CustomQueryInterface; | ||
| use App\Contracts\Interfaces\Eloquent\GetInterface; | ||
| use App\Contracts\Interfaces\Eloquent\StoreInterface; | ||
| use App\Contracts\Interfaces\Eloquent\DeleteInterface; | ||
| use App\Contracts\Interfaces\Eloquent\ShowInterface; | ||
| use App\Contracts\Interfaces\Eloquent\UpdateInterface; | ||
| interface SettingInterface extends GetInterface, StoreInterface, UpdateInterface, DeleteInterface, ShowInterface, CustomQueryInterface, CustomPaginateInterface | ||
| { | ||
|
|
||
| } |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coba check coment atas ya |
This file contains hidden or 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,56 @@ | ||
| <?php | ||
|
|
||
| namespace App\Contracts\Repositories\Master; | ||
|
|
||
| use App\Contracts\Interfaces\Master\RoleInterface; | ||
| use App\Contracts\Repositories\BaseRepository; | ||
| use App\Models\Role; | ||
| use Illuminate\Foundation\Mix; | ||
|
|
||
| class RoleRepository extends BaseRepository implements RoleInterface | ||
| { | ||
| public function __construct(Role $role) | ||
| { | ||
| $this->model = $role; | ||
| } | ||
|
|
||
| public function get(?int $perPage = null): mixed | ||
| { | ||
| return $perPage ? $this->model->paginate($perPage) : $this->model->get(); | ||
| } | ||
|
|
||
|
|
||
| public function show(mixed $id): mixed | ||
| { | ||
| return $this->model->find($id); | ||
| } | ||
|
|
||
| public function store(array $data): mixed | ||
| { | ||
| return $this->model->create($data); | ||
| } | ||
|
|
||
| // public function show(mixed $id): mixed | ||
| // { | ||
| // return $this->model->with('store')->withCount('roles')->find($id); | ||
| // } | ||
|
|
||
| public function update(mixed $id, array $data): mixed | ||
| { | ||
| return $this->show($id)->update($data); | ||
| } | ||
|
|
||
| public function delete(mixed $id): mixed | ||
| { | ||
| $role = $this->show($id); | ||
| return $role ? $role->delete() : false; | ||
| } | ||
|
|
||
| public function restore(mixed $id): mixed | ||
| { | ||
| $role = $this->model->withTrashed()->find($id); | ||
| return $role ? $role->restore() : false; | ||
| } | ||
|
|
||
|
|
||
| } |
This file contains hidden or 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,83 @@ | ||
| <?php | ||
|
|
||
| namespace App\Contracts\Repositories\Master; | ||
|
|
||
| use App\Models\Unit; | ||
| use App\Contracts\Repositories\BaseRepository; | ||
| use App\Contracts\Interfaces\Master\UnitInterface; | ||
|
|
||
|
|
||
| class UnitRepository extends BaseRepository implements UnitInterface | ||
| { | ||
|
|
||
| public function __construct(Unit $unit) | ||
| { | ||
| $this->model = $unit; | ||
| } | ||
|
|
||
| public function get(): mixed | ||
| { | ||
| return $this->model->get(); | ||
| } | ||
|
|
||
| public function store(array $data): mixed | ||
| { | ||
| return $this->model->create($data); | ||
| } | ||
|
|
||
| public function customQuery(array $data): mixed | ||
| { | ||
| return $this->model->query() | ||
| ->when(count($data) > 0, function ($query) use ($data){ | ||
| foreach ($data as $index => $value){ | ||
| $query->where($index, $value); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| public function customPaginate(int $pagination = 10, int $page = 1, ?array $data): mixed | ||
| { | ||
| return $this->model->query() | ||
| ->when(count($data) > 0, function ($query) use ($data){ | ||
| if(isset($data["search"])){ | ||
| $query->where(function ($query2) use ($data) { | ||
| $query2->where('name', 'like', '%' . $data["search"] . '%') | ||
| ->orwhere('code', 'like', '%' . $data["search"] . '%'); | ||
| }); | ||
| unset($data["search"]); | ||
| } | ||
|
|
||
| foreach ($data as $index => $value){ | ||
| $query->where($index, $value); | ||
| } | ||
| }) | ||
| ->paginate($pagination, ['*'], 'page', $page); | ||
| // ->appends(['search' => $request->search, 'year' => $request->year]); | ||
| } | ||
|
|
||
| public function show(mixed $id): mixed | ||
| { | ||
| return $this->model->find($id); | ||
| } | ||
|
|
||
| public function allDataTrashed(): mixed // Untuk mencari data yang dihapus | ||
| { | ||
| return $this->model->withTrashed()->get(); | ||
| } | ||
|
|
||
| public function update(mixed $id, array $data): mixed | ||
| { | ||
| return $this->show($id)->update($data); | ||
| } | ||
|
|
||
| public function delete(mixed $id): mixed | ||
| { | ||
| return $this->model->destroy($id); | ||
| } | ||
|
|
||
| public function all(): mixed | ||
| { | ||
| return $this->model->all(); | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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,70 @@ | ||
| <?php | ||
|
|
||
| namespace App\Contracts\Repositories; | ||
|
|
||
| use App\Contracts\Interfaces\SettingInterface; | ||
| use App\Models\Setting; | ||
| use Illuminate\Database\QueryException; | ||
|
|
||
| class SettingRepository extends BaseRepository implements SettingInterface | ||
| { | ||
| public function __construct(Setting $setting) | ||
| { | ||
| $this->model = $setting; | ||
| } | ||
|
|
||
| public function get(): mixed | ||
| { | ||
| return $this->model->all(); | ||
| } | ||
|
|
||
| public function store(array $data): mixed | ||
| { | ||
| return $this->model->create($data); | ||
| } | ||
|
|
||
| public function show(mixed $id): mixed | ||
| { | ||
| return $this->model->query()->find($id); | ||
| } | ||
|
|
||
| public function update(mixed $id, array $data): mixed | ||
| { | ||
| return $this->model->find($id)->update($data); | ||
| } | ||
|
|
||
| public function delete(mixed $id): mixed | ||
| { | ||
| return $this->show($id)->delete(); | ||
| } | ||
|
|
||
| public function customPaginate(int $pagination = 10, int $page = 1, ?array $data): mixed | ||
| { | ||
| return $this->model->query() | ||
| ->with('store') | ||
| ->when(count($data) > 0, function ($query) use ($data) { | ||
| if (isset($data["search"])) { | ||
| $query->where(function ($query2) use ($data) { | ||
| $query2->where('name', 'like', '%' . $data["search"] . '%'); | ||
| }); | ||
| unset($data["search"]); | ||
| } | ||
|
|
||
| foreach ($data as $index => $value) { | ||
| $query->where($index, $value); | ||
| } | ||
| }) | ||
| ->paginate($pagination, ['*'], 'page', $page); | ||
| // ->appends(['search' => $request->search, 'year' => $request->year]); | ||
| } | ||
|
|
||
| public function customQuery(array $data): mixed | ||
| { | ||
| return $this->model->query() | ||
| ->when(count($data) > 0, function ($query) use ($data) { | ||
| foreach ($data as $index => $value) { | ||
| $query->where($index, $value); | ||
| } | ||
| }); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ini jadi jadi pakai bawaan GetInterface atau mau bikin sendiri get function nya?