-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09a7631
commit 62c48bd
Showing
7 changed files
with
162 additions
and
47 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
database/migrations/2023_09_17_071311_create_english_language_record.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,23 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration { | ||
public function up(): void | ||
{ | ||
DB::table('languages') | ||
->insertOrIgnore([ | ||
'code' => 'en', | ||
'name' => 'English', | ||
]); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
DB::table('languages') | ||
->where('code', 'en') | ||
->delete(); | ||
} | ||
}; |
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 @@ | ||
import { authenticatedInstance } from '../factories/axios'; | ||
import { catchError, getData } from './helper'; | ||
|
||
const httpClient = authenticatedInstance; | ||
|
||
export const languageRepository = { | ||
index({ | ||
limit = 20, | ||
page = 1, | ||
sortBy = 'created_at', | ||
sortDirection = 'asc', | ||
}) { | ||
return httpClient | ||
.get('languages', { | ||
params: { | ||
limit, | ||
page, | ||
sort_by: sortBy, | ||
sort_direction: sortDirection, | ||
}, | ||
}) | ||
.then(getData) | ||
.catch(catchError); | ||
}, | ||
|
||
/** | ||
* | ||
* @param {{name: string, code: string}} data | ||
*/ | ||
create(data) { | ||
return httpClient.post(`languages`, data).then(getData).catch(catchError); | ||
}, | ||
|
||
destroy(id) { | ||
return httpClient.delete(`languages/${id}`).then(getData).catch(catchError); | ||
}, | ||
}; |
42 changes: 42 additions & 0 deletions
42
resources/js/console/repositories/translation.repository.js
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,42 @@ | ||
import { authenticatedInstance } from '../factories/axios'; | ||
import { catchError, getData } from './helper'; | ||
|
||
const httpClient = authenticatedInstance; | ||
|
||
export const fontRepository = { | ||
index({ | ||
limit = 20, | ||
page = 1, | ||
sortBy = 'created_at', | ||
sortDirection = 'asc', | ||
}) { | ||
return httpClient | ||
.get('fonts', { | ||
params: { | ||
limit, | ||
page, | ||
sort_by: sortBy, | ||
sort_direction: sortDirection, | ||
}, | ||
}) | ||
.then(getData) | ||
.catch(catchError); | ||
}, | ||
|
||
/** | ||
* | ||
* @param {FormData} data | ||
*/ | ||
create(data) { | ||
return httpClient | ||
.post(`fonts`, data, { | ||
headers: { 'Content-Type': 'multipart/form-data' }, | ||
}) | ||
.then(getData) | ||
.catch(catchError); | ||
}, | ||
|
||
destroy(id) { | ||
return httpClient.delete(`fonts/${id}`).then(getData).catch(catchError); | ||
}, | ||
}; |
42 changes: 42 additions & 0 deletions
42
resources/js/console/repositories/translationGroup.repository.js
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,42 @@ | ||
import { authenticatedInstance } from '../factories/axios'; | ||
import { catchError, getData } from './helper'; | ||
|
||
const httpClient = authenticatedInstance; | ||
|
||
export const fontRepository = { | ||
index({ | ||
limit = 20, | ||
page = 1, | ||
sortBy = 'created_at', | ||
sortDirection = 'asc', | ||
}) { | ||
return httpClient | ||
.get('fonts', { | ||
params: { | ||
limit, | ||
page, | ||
sort_by: sortBy, | ||
sort_direction: sortDirection, | ||
}, | ||
}) | ||
.then(getData) | ||
.catch(catchError); | ||
}, | ||
|
||
/** | ||
* | ||
* @param {FormData} data | ||
*/ | ||
create(data) { | ||
return httpClient | ||
.post(`fonts`, data, { | ||
headers: { 'Content-Type': 'multipart/form-data' }, | ||
}) | ||
.then(getData) | ||
.catch(catchError); | ||
}, | ||
|
||
destroy(id) { | ||
return httpClient.delete(`fonts/${id}`).then(getData).catch(catchError); | ||
}, | ||
}; |
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
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