Initial commit of testapi
This commit is contained in:
commit
a455aba1d5
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.{yml,yaml}]
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[docker-compose.yml]
|
||||||
|
indent_size = 4
|
65
.env.example
Normal file
65
.env.example
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
APP_LOCALE=en
|
||||||
|
APP_FALLBACK_LOCALE=en
|
||||||
|
APP_FAKER_LOCALE=en_US
|
||||||
|
|
||||||
|
APP_MAINTENANCE_DRIVER=file
|
||||||
|
# APP_MAINTENANCE_STORE=database
|
||||||
|
|
||||||
|
PHP_CLI_SERVER_WORKERS=4
|
||||||
|
|
||||||
|
BCRYPT_ROUNDS=12
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
LOG_STACK=single
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=null
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=sqlite
|
||||||
|
# DB_HOST=127.0.0.1
|
||||||
|
# DB_PORT=3306
|
||||||
|
# DB_DATABASE=laravel
|
||||||
|
# DB_USERNAME=root
|
||||||
|
# DB_PASSWORD=
|
||||||
|
|
||||||
|
SESSION_DRIVER=database
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
SESSION_ENCRYPT=false
|
||||||
|
SESSION_PATH=/
|
||||||
|
SESSION_DOMAIN=null
|
||||||
|
|
||||||
|
BROADCAST_CONNECTION=log
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=database
|
||||||
|
|
||||||
|
CACHE_STORE=database
|
||||||
|
# CACHE_PREFIX=
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_CLIENT=phpredis
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=log
|
||||||
|
MAIL_SCHEME=null
|
||||||
|
MAIL_HOST=127.0.0.1
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_FROM_ADDRESS="hello@example.com"
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
VITE_APP_NAME="${APP_NAME}"
|
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
* text=auto eol=lf
|
||||||
|
|
||||||
|
*.blade.php diff=html
|
||||||
|
*.css diff=css
|
||||||
|
*.html diff=html
|
||||||
|
*.md diff=markdown
|
||||||
|
*.php diff=php
|
||||||
|
|
||||||
|
CHANGELOG.md export-ignore
|
||||||
|
README.md export-ignore
|
45
.github/workflows/lint.yml
vendored
Normal file
45
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
name: linter
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
quality:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: '8.4'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: |
|
||||||
|
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
|
||||||
|
npm install
|
||||||
|
|
||||||
|
- name: Run Pint
|
||||||
|
run: vendor/bin/pint
|
||||||
|
|
||||||
|
- name: Format Frontend
|
||||||
|
run: npm run format
|
||||||
|
|
||||||
|
- name: Lint Frontend
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
# - name: Commit Changes
|
||||||
|
# uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
|
# with:
|
||||||
|
# commit_message: fix code style
|
||||||
|
# commit_options: '--no-verify'
|
53
.github/workflows/tests.yml
vendored
Normal file
53
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
name: tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ci:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: 8.4
|
||||||
|
tools: composer:v2
|
||||||
|
coverage: xdebug
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install Node Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
||||||
|
|
||||||
|
- name: Copy Environment File
|
||||||
|
run: cp .env.example .env
|
||||||
|
|
||||||
|
- name: Generate Application Key
|
||||||
|
run: php artisan key:generate
|
||||||
|
|
||||||
|
- name: Publish Ziggy Configuration
|
||||||
|
run: php artisan ziggy:generate
|
||||||
|
|
||||||
|
- name: Build Assets
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Tests
|
||||||
|
run: ./vendor/bin/pest
|
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/.phpunit.cache
|
||||||
|
/bootstrap/ssr
|
||||||
|
/node_modules
|
||||||
|
/public/build
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/storage/pail
|
||||||
|
/vendor
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.env.production
|
||||||
|
.phpactor.json
|
||||||
|
.phpunit.result.cache
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
/auth.json
|
||||||
|
/.fleet
|
||||||
|
/.idea
|
||||||
|
/.nova
|
||||||
|
/.vscode
|
||||||
|
/.zed
|
3
.prettierignore
Normal file
3
.prettierignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
resources/js/components/ui/*
|
||||||
|
resources/js/ziggy.js
|
||||||
|
resources/views/mail/*
|
18
.prettierrc
Normal file
18
.prettierrc
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"singleAttributePerLine": false,
|
||||||
|
"htmlWhitespaceSensitivity": "css",
|
||||||
|
"printWidth": 150,
|
||||||
|
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-tailwindcss"],
|
||||||
|
"tailwindFunctions": ["clsx", "cn"],
|
||||||
|
"tabWidth": 4,
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "**/*.yml",
|
||||||
|
"options": {
|
||||||
|
"tabWidth": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
399
api.json
Normal file
399
api.json
Normal file
@ -0,0 +1,399 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"info": {
|
||||||
|
"title": "API Testplatform",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "Mimicing the SmartDok api made by Visma"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost/api"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"http": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/Departments": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "department.index",
|
||||||
|
"summary": "GET /Departments\nQuery params:\n - departmentName (string)\n - updatedSince (date-time)",
|
||||||
|
"tags": [
|
||||||
|
"Department"
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"$ref": "#/components/responses/AuthenticationException"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/Departments/{id}": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "department.show",
|
||||||
|
"summary": "GET /Departments/{id}",
|
||||||
|
"tags": [
|
||||||
|
"Department"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"Id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Updated": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"Id",
|
||||||
|
"Name",
|
||||||
|
"Updated"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"$ref": "#/components/responses/AuthenticationException"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/Projects": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "project.index",
|
||||||
|
"summary": "GET /Projects\nQuery params:\n - projectNumber (string)\n - projectName (string)\n - updatedSince (date-time)\n - createdSince (date-time)",
|
||||||
|
"tags": [
|
||||||
|
"Project"
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"$ref": "#/components/responses/AuthenticationException"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/Projects/{id}": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "project.show",
|
||||||
|
"summary": "GET /Projects/{id}",
|
||||||
|
"tags": [
|
||||||
|
"Project"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"Id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"ProjectName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"ProjectNumber": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Departments": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"UserIds": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Updated": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Created": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"Id",
|
||||||
|
"ProjectName",
|
||||||
|
"ProjectNumber",
|
||||||
|
"Departments",
|
||||||
|
"UserIds",
|
||||||
|
"Updated",
|
||||||
|
"Created"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"$ref": "#/components/responses/ModelNotFoundException"
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"$ref": "#/components/responses/AuthenticationException"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/Users": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "smartdokProfile.index",
|
||||||
|
"description": "Returns a JSON array of all the smartdok users registered on the system\n\nExample response:\n{\n [\n \"Id\": \"00000000-0000-0000-0000-000000000000\",\n \"UserName\": \"string\",\n \"Name\": \"string\"\n ]\n}",
|
||||||
|
"summary": "List all users",
|
||||||
|
"tags": [
|
||||||
|
"SmartdokProfile"
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"$ref": "#/components/responses/AuthenticationException"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/Users/{id}": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "smartdokProfile.show",
|
||||||
|
"description": "Returns a JSON array of all the smartdok users registered on the system",
|
||||||
|
"summary": "Get a user",
|
||||||
|
"tags": [
|
||||||
|
"SmartdokProfile"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"Id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"UserName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"Id",
|
||||||
|
"UserName",
|
||||||
|
"Name"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"$ref": "#/components/responses/AuthenticationException"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/WorkHours": {
|
||||||
|
"get": {
|
||||||
|
"operationId": "workHour.index",
|
||||||
|
"description": "Required query params:\n - fromDate : date-time (filters work_date >= fromDate)\n - toDate : date-time (filters work_date <= toDate)\nOptional query param:\n - projectId : integer (filters by associated project)",
|
||||||
|
"summary": "GET /WorkHours",
|
||||||
|
"tags": [
|
||||||
|
"WorkHour"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "fromDate",
|
||||||
|
"in": "query",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "toDate",
|
||||||
|
"in": "query",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "projectId",
|
||||||
|
"in": "query",
|
||||||
|
"schema": {
|
||||||
|
"type": [
|
||||||
|
"integer",
|
||||||
|
"null"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"422": {
|
||||||
|
"$ref": "#/components/responses/ValidationException"
|
||||||
|
},
|
||||||
|
"401": {
|
||||||
|
"$ref": "#/components/responses/AuthenticationException"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"components": {
|
||||||
|
"securitySchemes": {
|
||||||
|
"http": {
|
||||||
|
"type": "http",
|
||||||
|
"scheme": "bearer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"AuthenticationException": {
|
||||||
|
"description": "Unauthenticated",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Error overview."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"message"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ModelNotFoundException": {
|
||||||
|
"description": "Not found",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Error overview."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"message"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ValidationException": {
|
||||||
|
"description": "Validation error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Errors overview."
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "A detailed description of each field that failed validation.",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"message",
|
||||||
|
"errors"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
app/Console/Commands/mkapiadmin.php
Normal file
57
app/Console/Commands/mkapiadmin.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\ApiAdmins;
|
||||||
|
|
||||||
|
class MkApiAdmin extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'mkapiadmin';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'List users without an ApiAdmins record and assign one to a selected user';
|
||||||
|
|
||||||
|
public function handle() {
|
||||||
|
|
||||||
|
$usersWithoutAdmin = User::doesntHave('apiAdmin')->get(['id', 'name', 'email']);
|
||||||
|
|
||||||
|
if ($usersWithoutAdmin->isEmpty()) {
|
||||||
|
$this->info("All users already have an ApiAdmins entry.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$options = $usersWithoutAdmin->map(function ($user) {
|
||||||
|
return "{$user->id}: {$user->name} ({$user->email})";
|
||||||
|
})->toArray();
|
||||||
|
|
||||||
|
$chosenString = $this->choice(
|
||||||
|
'Select a user to make an API Admin',
|
||||||
|
$options,
|
||||||
|
0, // default to the first index
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
[$chosenId] = explode(':', $chosenString, 2);
|
||||||
|
$chosenId = (int) trim($chosenId);
|
||||||
|
|
||||||
|
ApiAdmins::create([
|
||||||
|
'user_id' => $chosenId,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->info("User [ID: {$chosenId}] has been assigned as an API Admin.");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
454
app/Console/Commands/mkdemodata.php
Normal file
454
app/Console/Commands/mkdemodata.php
Normal file
@ -0,0 +1,454 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use App\Models\SmartdokProfile;
|
||||||
|
use App\Models\Department;
|
||||||
|
use App\Models\Project;
|
||||||
|
use App\Models\WorkHour;
|
||||||
|
|
||||||
|
class MkDemoData extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'mkdemodata
|
||||||
|
{--profiles : Generate SmartdokProfile demo data}
|
||||||
|
{--departments : Generate Department demo data}
|
||||||
|
{--projects : Generate Project demo data}
|
||||||
|
{--workhours : Generate WorkHour demo data}
|
||||||
|
';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Generate demo data for SmartdokProfile, Department, Project, and WorkHour models';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
// Define arrays for random selection (fill these later)
|
||||||
|
$profileNames = [
|
||||||
|
'first_names' => [
|
||||||
|
"Aksel", "Alma", "Andreas", "Anna", "Arne", "Aurora", "Benedicte", "Benjamin", "Bjørn", "Camilla",
|
||||||
|
"Cecilie", "Christer", "Dag", "Daniel", "David", "Einar", "Eirik", "Elin", "Emil", "Emilie",
|
||||||
|
"Erik", "Even", "Fredrik", "Gerd", "Grethe", "Gunnar", "Halvor", "Hanna", "Hans", "Håkon",
|
||||||
|
"Hege", "Henrik", "Ida", "Ingrid", "Ivar", "Jan", "Jens", "Joakim", "Johanne", "Jonas",
|
||||||
|
"Jorunn", "Jørgen", "Julie", "Kaja", "Kari", "Karoline", "Kasper", "Katrine", "Kenneth", "Kim",
|
||||||
|
"Kine", "Kristian", "Kristin", "Kurt", "Lars", "Leif", "Line", "Linn", "Lise", "Liv",
|
||||||
|
"Magnus", "Maja", "Maren", "Maria", "Marie", "Marit", "Markus", "Marthe", "Martin", "Mathias",
|
||||||
|
"Mats", "Mette", "Mia", "Mikkel", "Mona", "Nils", "Nina", "Odd", "Ola", "Ole",
|
||||||
|
"Oskar", "Pål", "Per", "Ragnhild", "Rasmus", "Reidar", "Renate", "Roar", "Robert", "Ronny",
|
||||||
|
"Rune", "Sander", "Sandra", "Sara", "Signe", "Silje", "Simen", "Siri", "Sofie", "Stian"
|
||||||
|
],
|
||||||
|
'last_names' => [
|
||||||
|
"Andersen", "Antonsen", "Aune", "Bakke", "Berg", "Berge", "Berntsen", "Birkeland", "Blom", "Borge",
|
||||||
|
"Dahl", "Dale", "Danielsen", "Egeland", "Eggen", "Eide", "Eliassen", "Eriksen", "Evensen", "Fjeld",
|
||||||
|
"Fjell", "Fredriksen", "Furseth", "Gabrielsen", "Gundersen", "Gustavsen", "Halvorsen", "Hansen", "Haugen", "Hauge",
|
||||||
|
"Haugland", "Hellesøy", "Hellevik", "Hemmingsen", "Hovland", "Husby", "Iversen", "Jakobsen", "Jensen", "Johannesen",
|
||||||
|
"Johansen", "Johnsen", "Karlsen", "Knudsen", "Knutsen", "Kristensen", "Kristiansen", "Krogstad", "Kvamme", "Langli",
|
||||||
|
"Larsen", "Lauvik", "Lie", "Lund", "Magnussen", "Martinsen", "Mathisen", "Mikkelsen", "Moen", "Myhre",
|
||||||
|
"Nergaard", "Nilsen", "Nordahl", "Nordby", "Næss", "Olsen", "Opdahl", "Pedersen", "Rasmussen", "Rognli",
|
||||||
|
"Rønning", "Rygh", "Sand", "Sandberg", "Sandnes", "Simonsen", "Sivertsen", "Skogen", "Solbakken", "Solberg",
|
||||||
|
"Sørensen", "Stavrum", "Stenersen", "Stokke", "Strand", "Strømsø", "Sund", "Sveen", "Sæther", "Sørli",
|
||||||
|
"Tangen", "Tellefsen", "Thoresen", "Tveit", "Ulriksen", "Vagle", "Vik", "Viken", "Vold", "Ødegård"
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$departmentNames = [
|
||||||
|
"Økonomiavdelingen", "Personalavdelingen", "HR-avdelingen", "IT-avdelingen", "Driftsavdelingen",
|
||||||
|
"Kommunikasjonsavdelingen", "Kundeservice", "Forskning og utvikling", "Lønnsavdelingen", "Regnskapsavdelingen",
|
||||||
|
"Innkjøpsavdelingen", "Juridisk avdeling", "Markedsavdelingen", "Salgsteamet", "Servicedesk", "Supportavdelingen",
|
||||||
|
"Prosjektavdelingen", "Planavdelingen", "Byggesaksavdelingen", "Teknisk avdeling", "Strategiavdelingen",
|
||||||
|
"Ledelsessekretariatet", "Analyseavdelingen", "Utdanningsseksjonen", "Arkivavdelingen", "Rekrutteringsavdelingen",
|
||||||
|
"Brukerstøtte", "Digitaliseringsavdelingen", "Innovasjonsavdelingen", "Logistikkavdelingen", "Miljøavdelingen",
|
||||||
|
"HMS-avdelingen", "Sikkerhetsavdelingen", "Kvalitetsavdelingen", "Tjenesteutvikling", "Operativ enhet",
|
||||||
|
"Forvaltningsavdelingen", "Bymiljøavdelingen", "Oppvekstavdelingen", "Barnehageseksjonen", "Skoleseksjonen",
|
||||||
|
"Teknologi og utvikling", "Næringsavdelingen", "Kulturavdelingen", "Informasjonsavdelingen", "Kommuneadvokaten",
|
||||||
|
"Internrevisjonen", "Kundeopplevelse", "Datavarehus og innsikt", "Strategi og analyse", "Digital transformasjon",
|
||||||
|
"Utvendig drift", "Intern IT", "Fagavdelingen", "Avdeling for samfunnskontakt", "Avdeling for prosjektledelse",
|
||||||
|
"Forretningsutvikling", "Transportavdelingen", "Eiendomsforvaltning", "Reiselivsavdelingen", "Dokumentsenteret",
|
||||||
|
"Systemforvaltning", "Brannsikkerhet", "HR og organisasjon", "Lønn og personal", "Budsjett og finans",
|
||||||
|
"Saksbehandlerteam", "Brukeradministrasjon", "Forskningsstøtte", "Utviklingsseksjonen", "Teknisk støtte",
|
||||||
|
"HR-partnere", "Drift og vedlikehold", "IT-sikkerhet", "Skatteoppfølging", "Kundeavdelingen",
|
||||||
|
"Infrastruktur og nettverk", "Sosiale medier-teamet", "Reiseadministrasjon", "Journalføring og arkiv",
|
||||||
|
"Prosessforbedring", "Arbeidsmiljøutvalget", "Produktutvikling", "Digital kommunikasjon", "Revisjonsavdelingen",
|
||||||
|
"Kundereisen", "Tjenestekatalog", "Fagstab", "Innbyggertorg", "Velferdstjenester", "Beredskap og krisehåndtering",
|
||||||
|
"Kontor for internasjonalt samarbeid", "Eierskapsavdelingen", "Fellesadministrasjonen", "Boligforvaltning",
|
||||||
|
"Avdeling for offentlige anskaffelser", "Datateamet", "Digital forvaltning", "Informasjonssikkerhet",
|
||||||
|
"Strategisk stab", "Kvalitet og forbedring", "Kunnskapsutvikling"
|
||||||
|
];
|
||||||
|
|
||||||
|
$projectNames = [
|
||||||
|
"Prosjekt Ny Start", "Digital Fremtid", "Kunde360", "Grønn Omstilling", "Effektiv Drift",
|
||||||
|
"Smart By 2030", "Trygg Skolevei", "Rekrutt 2.0", "Digital Samhandling", "Datadrevet Innsikt",
|
||||||
|
"Prosjekt Arbeidsglede", "Bærekraft i Fokus", "Felles Plattform", "Modernisering 2025", "Mobil Først",
|
||||||
|
"HR Next", "Prosjekt Miljøbyen", "Felles HR-system", "Digital Arkivflyt", "Innbyggerdialog 2.0",
|
||||||
|
"Kontor for Kontor", "Prosjekt Klar Tale", "Trygg og Sikker", "Ny Visuell Profil", "Skytjenester 2026",
|
||||||
|
"Innovasjonsløftet", "Samspill 2.0", "Prosjekt Klarhet", "Grønn Mobilitet", "StrategiReboot",
|
||||||
|
"Kvalitet i Tjenester", "Prosjekt Kompetanse", "Smidig Overgang", "Felles IT-struktur", "Innkjøpsløft",
|
||||||
|
"Smart Skole", "Effektiv Bemanning", "Energi og Effektivitet", "Prosjekt God Morgen", "Digitale Prosesser",
|
||||||
|
"Veien Videre", "Prosjekt Nye Muligheter", "Framtidens Hjemmetjeneste", "Datadeling i Praksis", "Innbyggerportalen",
|
||||||
|
"Felles Sakssystem", "Trygg Hverdag", "Ren Digitalisering", "Grønn Strategi", "Prosjekt Ny Giv",
|
||||||
|
"Et Bedre Arbeidsmiljø", "Prosjekt Enhet", "Digital Tilgjengelighet", "Smart Infrastruktur", "Papirløs 2025",
|
||||||
|
"Prosjekt Riktig Kompetanse", "Sikkerhet i Fokus", "Kontinuerlig Forbedring", "Prosjekt Klar Oversikt",
|
||||||
|
"Felles Kommunikasjon", "Miljømål 2030", "Reisen til Skyen", "Tilbake til Kontoret", "Prosjekt Digital Kultur",
|
||||||
|
"Brukerfokusert Utvikling", "Automatisering Nå", "Egenmeldt Framtid", "Prosjekt Innsikt", "Felles Digitale Flater",
|
||||||
|
"Plattform24", "Grønn Drift", "Prosjekt Datasikkerhet", "Ny Struktur", "Arbeid 2.0", "Prosjekt Kompetanseløft",
|
||||||
|
"Strategisk Veikart", "Fremtidens Kontor", "Digital Styring", "Reisefri Samhandling", "Prosjekt Smarte Løsninger",
|
||||||
|
"Brukeren Først", "Prosjekt Nye Rammer", "Nyskapning i Nord", "Helhetlig Tjenestereise", "Grønt Innkjøp",
|
||||||
|
"DataHub Kommunal", "Lønn og Rolle", "Digital Døgnåpen", "Prosjekt Kontinuitet", "Klima og Energi",
|
||||||
|
"Sikker Jobbhverdag", "Smart Senterstruktur", "Ny HR-portal", "Kundereise i Fokus", "Automatiseringsløftet",
|
||||||
|
"Tjenestedesign 2025", "Effektiv Vedlikehold", "Nye Arbeidsformer", "Avviksfri Drift", "Innsyn og Åpenhet",
|
||||||
|
"Framtidens Elevtjeneste", "Strategisk Sikkerhet", "Felles Admin", "Velferd på Nett", "Kunnskapsløft Intern"
|
||||||
|
];
|
||||||
|
|
||||||
|
$workHourComments = [
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 1,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 2. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Deltok i brukertest for Prosjekt 3,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 4. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 5,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 6,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 7,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Oppdaterte prosjektstyringsverktøy for Prosjekt 8 etter interne endringer. Loggførte aktiviteter,
|
||||||
|
justerte tidslinjer og la til kommentarer for tydeligere historikk. Dette gir teamet bedre oversikt over fremdriften.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 9,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Deltok i brukertest for Prosjekt 10,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 11. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Oppdaterte prosjektstyringsverktøy for Prosjekt 12 etter interne endringer. Loggførte aktiviteter,
|
||||||
|
justerte tidslinjer og la til kommentarer for tydeligere historikk. Dette gir teamet bedre oversikt over fremdriften.",
|
||||||
|
"Deltok i brukertest for Prosjekt 13,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 14. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 15,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 16,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 17,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Deltok i brukertest for Prosjekt 18,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Deltok i brukertest for Prosjekt 19,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Skrev referat fra prosjektmøte i Prosjekt 20. Oppsummerte beslutninger,
|
||||||
|
fordelte oppgaver og lastet opp til felles dokumentbibliotek. Sendte ut e-post til alle involverte med påminnelser og neste møtetidspunkt.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 21,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 22. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 23,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Skrev referat fra prosjektmøte i Prosjekt 24. Oppsummerte beslutninger,
|
||||||
|
fordelte oppgaver og lastet opp til felles dokumentbibliotek. Sendte ut e-post til alle involverte med påminnelser og neste møtetidspunkt.",
|
||||||
|
"Oppdaterte prosjektstyringsverktøy for Prosjekt 25 etter interne endringer. Loggførte aktiviteter,
|
||||||
|
justerte tidslinjer og la til kommentarer for tydeligere historikk. Dette gir teamet bedre oversikt over fremdriften.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 26,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 27,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 28,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 29,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 30,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 31. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 32,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 33,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Deltok i brukertest for Prosjekt 34,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 35,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 36,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 37,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 38. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Skrev referat fra prosjektmøte i Prosjekt 39. Oppsummerte beslutninger,
|
||||||
|
fordelte oppgaver og lastet opp til felles dokumentbibliotek. Sendte ut e-post til alle involverte med påminnelser og neste møtetidspunkt.",
|
||||||
|
"Deltok i brukertest for Prosjekt 40,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 41,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 42,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 43,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 44,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 45,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 46,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Skrev referat fra prosjektmøte i Prosjekt 47. Oppsummerte beslutninger,
|
||||||
|
fordelte oppgaver og lastet opp til felles dokumentbibliotek. Sendte ut e-post til alle involverte med påminnelser og neste møtetidspunkt.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 48. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 49,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Oppdaterte prosjektstyringsverktøy for Prosjekt 50 etter interne endringer. Loggførte aktiviteter,
|
||||||
|
justerte tidslinjer og la til kommentarer for tydeligere historikk. Dette gir teamet bedre oversikt over fremdriften.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 51. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 52. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 53. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 54. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 55,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Skrev referat fra prosjektmøte i Prosjekt 56. Oppsummerte beslutninger,
|
||||||
|
fordelte oppgaver og lastet opp til felles dokumentbibliotek. Sendte ut e-post til alle involverte med påminnelser og neste møtetidspunkt.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 57. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 58. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 59,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 60,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 61,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 62. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Deltok i brukertest for Prosjekt 63,
|
||||||
|
der vi samlet tilbakemeldinger fra interne brukere. Dokumenterte funn og oppdaterte kravspesifikasjonen i henhold til det som kom fram. Viktig del av iterativ utvikling.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 64. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 65,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 66,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Oppdaterte prosjektstyringsverktøy for Prosjekt 67 etter interne endringer. Loggførte aktiviteter,
|
||||||
|
justerte tidslinjer og la til kommentarer for tydeligere historikk. Dette gir teamet bedre oversikt over fremdriften.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 68. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 69,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 70,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 71,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 72,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 73,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 74,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 75,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 76,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 77,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 78,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 79,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Oppdaterte prosjektstyringsverktøy for Prosjekt 80 etter interne endringer. Loggførte aktiviteter,
|
||||||
|
justerte tidslinjer og la til kommentarer for tydeligere historikk. Dette gir teamet bedre oversikt over fremdriften.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 81,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 82,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 83,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 84. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 85,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Utviklet nye funksjoner i løsningen for Prosjekt 86,
|
||||||
|
inkludert testing og dokumentasjon. Samarbeidet tett med utviklingsteamet for å løse oppdagede bugs og sikre en stabil leveranse til neste sprint.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 87. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 88,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 89. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 90. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Skrev referat fra prosjektmøte i Prosjekt 91. Oppsummerte beslutninger,
|
||||||
|
fordelte oppgaver og lastet opp til felles dokumentbibliotek. Sendte ut e-post til alle involverte med påminnelser og neste møtetidspunkt.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 92. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Arbeidet med analyse og innsiktsinnsamling for Prosjekt 93. Brukte tid på å hente ut data,
|
||||||
|
kvalitetssikre informasjon og lage et første utkast til rapport. Resultatene vil bidra til bedre beslutningsgrunnlag videre i prosessen.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 94,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Deltok i møte med prosjektgruppen for Prosjekt 95,
|
||||||
|
hvor vi diskuterte fremdriften og identifiserte eventuelle flaskehalser. Gjennomgikk dokumentasjon og oppdaterte prosjektplaner for å sikre at alle involverte er informert.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 96,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
"Gjorde teknisk oppsett i utviklingsmiljøet for Prosjekt 97,
|
||||||
|
inkludert konfigurering av servere og deploy-rutiner. Brukte god tid på testing og feilretting for å sikre at systemet fungerer som forventet.",
|
||||||
|
"Hjalp til med forberedelser til workshop for Prosjekt 98. Laget presentasjonsmateriell,
|
||||||
|
organiserte agenda og koordinerte med eksterne bidragsytere. Fokuset var å sikre god involvering og innsikt fra deltakerne.",
|
||||||
|
"Gjennomførte kvalitetssikring av eksisterende leveranser i Prosjekt 99. Gikk gjennom dokumentasjon,
|
||||||
|
sjekket etter avvik og laget en oppsummeringsrapport med anbefalinger. Dette gir bedre struktur og oversikt fremover.",
|
||||||
|
"Gjennomførte presentasjon for ledelsen om status i Prosjekt 100,
|
||||||
|
inkludert nøkkeltall,
|
||||||
|
risikoer og anbefalinger. Fikk gode tilbakemeldinger og justerte fokus for neste uke basert på innspillene.",
|
||||||
|
];
|
||||||
|
|
||||||
|
// Generate SmartdokProfile data
|
||||||
|
if ($this->option('profiles')) {
|
||||||
|
$count = (int) $this->ask('How many SmartdokProfile records do you want to create? (1-1000)');
|
||||||
|
if ($count < 1 || $count > 1000) {
|
||||||
|
$this->error('Please enter a number between 1 and 1000.');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
$first = Arr::random($profileNames['first_names']);
|
||||||
|
$last = Arr::random($profileNames['last_names']);
|
||||||
|
$username = Str::slug(strtolower("{$first}.{$last}"));
|
||||||
|
|
||||||
|
SmartdokProfile::create([
|
||||||
|
'id' => (string) Str::uuid(),
|
||||||
|
'username' => $username,
|
||||||
|
'name' => "{$first} {$last}",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info("Successfully created {$count} SmartdokProfile records.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate Department data
|
||||||
|
if ($this->option('departments')) {
|
||||||
|
$count = (int) $this->ask('How many Department records do you want to create? (1-1000)');
|
||||||
|
if ($count < 1 || $count > 1000) {
|
||||||
|
$this->error('Please enter a number between 1 and 1000.');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
Department::create([
|
||||||
|
'name' => Arr::random($departmentNames),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info("Successfully created {$count} Department records.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate Project data (requires at least one profile and one department)
|
||||||
|
if ($this->option('projects')) {
|
||||||
|
if (SmartdokProfile::count() === 0 || Department::count() === 0) {
|
||||||
|
$this->error('Cannot create projects: please ensure at least one SmartdokProfile and one Department exist.');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
foreach ($projectNames as $name) {
|
||||||
|
$project = Project::create([
|
||||||
|
'project_name' => $name,
|
||||||
|
'project_number' => (string) rand(1000, 9999),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Attach random profiles and departments
|
||||||
|
$profileIds = SmartdokProfile::inRandomOrder()->take(rand(1, 3))->pluck('id')->toArray();
|
||||||
|
$departmentIds = Department::inRandomOrder()->take(rand(1, 3))->pluck('id')->toArray();
|
||||||
|
|
||||||
|
$project->profiles()->attach($profileIds);
|
||||||
|
$project->departments()->attach($departmentIds);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info("Successfully created {$i} Project records (with random attachments).");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate WorkHour data (requires at least one profile and one project)
|
||||||
|
if ($this->option('workhours')) {
|
||||||
|
if (SmartdokProfile::count() === 0 || Project::count() === 0) {
|
||||||
|
$this->error('Cannot create work hours: please ensure at least one SmartdokProfile and one Project exist.');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$count = (int) $this->ask('How many WorkHour records do you want to create? (1-1000)');
|
||||||
|
if ($count < 1 || $count > 1000) {
|
||||||
|
$this->error('Please enter a number between 1 and 1000.');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$startInput = $this->ask('Enter start date (dd/mm/YYYY)');
|
||||||
|
$endInput = $this->ask('Enter end date (dd/mm/YYYY)');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$start = Carbon::createFromFormat('d/m/Y', $startInput)->startOfDay();
|
||||||
|
$end = Carbon::createFromFormat('d/m/Y', $endInput)->endOfDay();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$this->error('Invalid date format. Please use dd/mm/YYYY.');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
$userId = SmartdokProfile::inRandomOrder()->first()->id;
|
||||||
|
$projectId = Project::inRandomOrder()->first()->id;
|
||||||
|
$ordinaryHours = rand(1, 8);
|
||||||
|
$comment = Arr::random($workHourComments);
|
||||||
|
|
||||||
|
// Pick a random timestamp between start and end
|
||||||
|
$timestamp = rand($start->timestamp, $end->timestamp);
|
||||||
|
$workDate = Carbon::createFromTimestamp($timestamp)->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
|
WorkHour::create([
|
||||||
|
'user_id' => $userId,
|
||||||
|
'project_id' => $projectId,
|
||||||
|
'ordinary_hours'=> $ordinaryHours,
|
||||||
|
'work_date' => $workDate,
|
||||||
|
'comment' => $comment,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info("Successfully created {$count} WorkHour records.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
49
app/Console/Commands/mkuser.php
Normal file
49
app/Console/Commands/mkuser.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class mkuser extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'app:mkuser';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Create a new user interactively';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
// Gather user information
|
||||||
|
$name = $this->ask('Enter the user name');
|
||||||
|
$email = $this->ask('Enter the user email');
|
||||||
|
$password = $this->secret('Enter the user password');
|
||||||
|
|
||||||
|
// Create the user
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $name,
|
||||||
|
'email' => $email,
|
||||||
|
'password' => Hash::make($password),
|
||||||
|
'email_verified_at' => Carbon::now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Output success message
|
||||||
|
$this->info("User '{$user->name}' ({$user->email}) created successfully with ID {$user->id}.");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
42
app/Console/Commands/rmapiadmin.php
Normal file
42
app/Console/Commands/rmapiadmin.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\ApiAdmins;
|
||||||
|
|
||||||
|
class RmApiAdmin extends Command
|
||||||
|
{
|
||||||
|
protected $signature = 'rmapiadmin';
|
||||||
|
protected $description = 'List users with an ApiAdmins record and remove the relationship';
|
||||||
|
|
||||||
|
public function handle() {
|
||||||
|
$users = User::has('apiAdmin')
|
||||||
|
->orderBy('id')
|
||||||
|
->get(['id', 'name', 'email']);
|
||||||
|
|
||||||
|
if ($users->isEmpty()) {
|
||||||
|
$this->info('No users currently assigned as API Admin.');
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$choices = $users->map(fn($u) => "{$u->id}: {$u->name} ({$u->email})")->toArray();
|
||||||
|
|
||||||
|
$selected = $this->choice(
|
||||||
|
'Select a user to remove from API Admins',
|
||||||
|
$choices,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
[$idString] = explode(':', $selected, 2);
|
||||||
|
$userId = (int) trim($idString);
|
||||||
|
|
||||||
|
ApiAdmins::where('user_id', $userId)->delete();
|
||||||
|
|
||||||
|
$this->info("User ID {$userId} has been removed from API Admins.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
58
app/Console/Commands/rmdemodata.php
Normal file
58
app/Console/Commands/rmdemodata.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use App\Models\SmartdokProfile;
|
||||||
|
use App\Models\Department;
|
||||||
|
use App\Models\Project;
|
||||||
|
use App\Models\WorkHour;
|
||||||
|
|
||||||
|
class RmDemoData extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'rmdemodata';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Remove all demo data for SmartdokProfile, Department, Project, and WorkHour models';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->info('Removing all demo data...');
|
||||||
|
|
||||||
|
// Disable foreign key checks for all supported DB drivers
|
||||||
|
Schema::disableForeignKeyConstraints();
|
||||||
|
|
||||||
|
// Truncate pivot tables
|
||||||
|
DB::table('project_smartdok_profile')->truncate();
|
||||||
|
DB::table('department_project')->truncate();
|
||||||
|
|
||||||
|
// Truncate core tables
|
||||||
|
WorkHour::truncate();
|
||||||
|
Project::truncate();
|
||||||
|
SmartdokProfile::truncate();
|
||||||
|
Department::truncate();
|
||||||
|
|
||||||
|
// Re-enable foreign key checks
|
||||||
|
Schema::enableForeignKeyConstraints();
|
||||||
|
|
||||||
|
$this->info('All demo data removed successfully.');
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
49
app/Http/Controllers/Api/AuthenticationController.php
Normal file
49
app/Http/Controllers/Api/AuthenticationController.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class AuthenticationController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @unauthenticated
|
||||||
|
*
|
||||||
|
* @return "{'status': 'success','token': 'plaintexttoken'}"
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function authorize(Request $request) {
|
||||||
|
$request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required|string'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$request->has('email') || !$request->has('password')) {
|
||||||
|
return json_encode([
|
||||||
|
'status' => 'invalid',
|
||||||
|
'message' => 'ingen brukernavn eller passord oppgitt'
|
||||||
|
], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$credentials = $request->only('email', 'password');
|
||||||
|
|
||||||
|
if (Auth::attempt($credentials)) {
|
||||||
|
$user = Auth::user();
|
||||||
|
$token = $user->createToken($request->token_name ?? 'default');
|
||||||
|
return json_encode([
|
||||||
|
'status' => 'success',
|
||||||
|
'token' => $token->plainTextToken
|
||||||
|
], Response::HTTP_ACCEPTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode([
|
||||||
|
'status' => 'invalid',
|
||||||
|
'message' => 'ugyldig bruker/passord'
|
||||||
|
], Response::HTTP_UNAUTHORIZED);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
53
app/Http/Controllers/Api/DepartmentController.php
Normal file
53
app/Http/Controllers/Api/DepartmentController.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\Department;
|
||||||
|
|
||||||
|
class DepartmentController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* GET /Departments
|
||||||
|
* Query params:
|
||||||
|
* - departmentName (string)
|
||||||
|
* - updatedSince (date-time)
|
||||||
|
*/
|
||||||
|
public function index(Request $request) {
|
||||||
|
$q = Department::query();
|
||||||
|
|
||||||
|
if ($name = $request->query('departmentName')) {
|
||||||
|
$q->where('name', $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($since = $request->query('updatedSince')) {
|
||||||
|
$q->where('updated_at', '>=', Carbon::parse($since));
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = $q->get()->map(function ($d) {
|
||||||
|
return [
|
||||||
|
'Id' => $d->id,
|
||||||
|
'Name' => $d->name,
|
||||||
|
'Updated' => $d->updated_at->toIso8601String().'Z',
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json($out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /Departments/{id}
|
||||||
|
*/
|
||||||
|
public function show(int $id) {
|
||||||
|
$d = Department::findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'Id' => $d->id,
|
||||||
|
'Name' => $d->name,
|
||||||
|
'Updated' => $d->updated_at->toIso8601String().'Z',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
68
app/Http/Controllers/Api/ProjectController.php
Normal file
68
app/Http/Controllers/Api/ProjectController.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\Project;
|
||||||
|
|
||||||
|
class ProjectController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* GET /Projects
|
||||||
|
* Query params:
|
||||||
|
* - projectNumber (string)
|
||||||
|
* - projectName (string)
|
||||||
|
* - updatedSince (date-time)
|
||||||
|
* - createdSince (date-time)
|
||||||
|
*/
|
||||||
|
public function index(Request $request) {
|
||||||
|
$q = Project::with(['departments', 'profiles']);
|
||||||
|
|
||||||
|
if ($num = $request->query('projectNumber')) {
|
||||||
|
$q->where('project_number', $num);
|
||||||
|
}
|
||||||
|
if ($name = $request->query('projectName')) {
|
||||||
|
$q->where('project_name', $name);
|
||||||
|
}
|
||||||
|
if ($sinceUp = $request->query('updatedSince')) {
|
||||||
|
$q->where('updated_at', '>=', Carbon::parse($sinceUp));
|
||||||
|
}
|
||||||
|
if ($sinceCr = $request->query('createdSince')) {
|
||||||
|
$q->where('created_at', '>=', Carbon::parse($sinceCr));
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = $q->get()->map(function ($p) {
|
||||||
|
return [
|
||||||
|
'Id' => $p->id,
|
||||||
|
'ProjectName' => $p->project_name,
|
||||||
|
'ProjectNumber' => $p->project_number,
|
||||||
|
'Departments' => $p->departments->pluck('id')->all(),
|
||||||
|
'UserIds' => $p->profiles->pluck('id')->all(),
|
||||||
|
'Updated' => $p->updated_at->toIso8601String().'Z',
|
||||||
|
'Created' => $p->created_at->toIso8601String().'Z',
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json($out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /Projects/{id}
|
||||||
|
*/
|
||||||
|
public function show(int $id) {
|
||||||
|
$p = Project::with(['departments', 'profiles'])->findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'Id' => $p->id,
|
||||||
|
'ProjectName' => $p->project_name,
|
||||||
|
'ProjectNumber' => $p->project_number,
|
||||||
|
'Departments' => $p->departments->pluck('id')->all(),
|
||||||
|
'UserIds' => $p->profiles->pluck('id')->all(),
|
||||||
|
'Updated' => $p->updated_at->toIso8601String().'Z',
|
||||||
|
'Created' => $p->created_at->toIso8601String().'Z',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
140
app/Http/Controllers/Api/SmartdokLiveController.php
Normal file
140
app/Http/Controllers/Api/SmartdokLiveController.php
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\ApiKeys;
|
||||||
|
|
||||||
|
class SmartdokLiveController extends Controller
|
||||||
|
{
|
||||||
|
private string $serviceName = 'smartdok';
|
||||||
|
private string $apiKey;
|
||||||
|
private string $authToken;
|
||||||
|
|
||||||
|
private string $serviceUrl = 'https://api.smartdok.no';
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$record = ApiKeys::where('category', $this->serviceName)->first();
|
||||||
|
if (! $record) {
|
||||||
|
throw new HttpResponseException(
|
||||||
|
response()->json([
|
||||||
|
'feil' => "ingen tjenesteoppføring funnet for tjenesten '{$this->serviceName}', som betyr at du ikke har definert en API nøkkel for denne tjenesten enda. Logg inn og legg til en API nøkkel først"
|
||||||
|
], 404)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->apiKey = $record->key;
|
||||||
|
|
||||||
|
$smartdokAuthorizeRequest = Http::withHeaders([
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->post("{$this->serviceUrl}/Authorize/ApiToken", [
|
||||||
|
'input' => $this->apiKey
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $smartdokAuthorizeRequest->json();
|
||||||
|
|
||||||
|
if (!isset($response['Token'])) {
|
||||||
|
throw new HttpResponseException(
|
||||||
|
response()->json([
|
||||||
|
'feil' => "Kunne ikke hente Visma SmartDok autorisasjon ved bruk av den lagrede API nøkkelen i mellomvaren"
|
||||||
|
], 403)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->authToken = $response['Token'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function users() {
|
||||||
|
$smartdokUsersRequest = Http::withHeaders([
|
||||||
|
'Authorization' => "Bearer {$this->authToken}",
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->get("{$this->serviceUrl}/Users");
|
||||||
|
|
||||||
|
return $smartdokUsersRequest->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user(string $id) {
|
||||||
|
$smartdokUsersRequest = Http::withHeaders([
|
||||||
|
'Authorization' => "Bearer {$this->authToken}",
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->get("{$this->serviceUrl}/Users/{$id}");
|
||||||
|
|
||||||
|
return $smartdokUsersRequest->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function departments() {
|
||||||
|
$smartdokDepartmentsRequest = Http::withHeaders([
|
||||||
|
'Authorization' => "Bearer {$this->authToken}",
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->get("{$this->serviceUrl}/Departments");
|
||||||
|
|
||||||
|
return $smartdokDepartmentsRequest->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function department(string $id) {
|
||||||
|
$smartdokDepartmentsRequest = Http::withHeaders([
|
||||||
|
'Authorization' => "Bearer {$this->authToken}",
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->get("{$this->serviceUrl}/Departments/{$id}");
|
||||||
|
|
||||||
|
return $smartdokDepartmentsRequest->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function projects() {
|
||||||
|
$smartdokProjectsRequest = Http::withHeaders([
|
||||||
|
'Authorization' => "Bearer {$this->authToken}",
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->get("{$this->serviceUrl}/Projects");
|
||||||
|
|
||||||
|
return $smartdokProjectsRequest->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function project(string $id) {
|
||||||
|
$smartdokProjectsRequest = Http::withHeaders([
|
||||||
|
'Authorization' => "Bearer {$this->authToken}",
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->get("{$this->serviceUrl}/Projects/{$id}");
|
||||||
|
|
||||||
|
return $smartdokProjectsRequest->json();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function WorkHours(Request $request) {
|
||||||
|
$request->validate([
|
||||||
|
'fromDate' => 'required|date',
|
||||||
|
'toDate' => 'required|date',
|
||||||
|
'projectId' => 'nullable|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$from = Carbon::parse($request->query('fromDate'))
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString(); // “2025-05-12 00:00:00”
|
||||||
|
|
||||||
|
$to = Carbon::parse($request->query('toDate'))
|
||||||
|
->endOfDay()
|
||||||
|
->toDateTimeString(); // “2025-05-12 23:59:59”
|
||||||
|
|
||||||
|
$query = [
|
||||||
|
'fromDate' => $from,
|
||||||
|
'toDate' => $to,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (! is_null($request->input('projectId'))) {
|
||||||
|
$query['projectId'] = $request->input('projectId');
|
||||||
|
}
|
||||||
|
|
||||||
|
$smartdokWorkHourRequest = Http::withHeaders([
|
||||||
|
'Authorization' => "Bearer {$this->authToken}",
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
])->get("{$this->serviceUrl}/WorkHours", $query);
|
||||||
|
|
||||||
|
return $smartdokWorkHourRequest->json();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
54
app/Http/Controllers/Api/SmartdokProfileController.php
Normal file
54
app/Http/Controllers/Api/SmartdokProfileController.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
use App\Models\SmartdokProfile;
|
||||||
|
|
||||||
|
class SmartdokProfileController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* List all users
|
||||||
|
*
|
||||||
|
* Returns a JSON array of all the smartdok users registered on the system
|
||||||
|
*
|
||||||
|
* @response \App\Models\SmartdokProfile
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$profiles = SmartdokProfile::all()->map(function ($p) {
|
||||||
|
return [
|
||||||
|
'Id' => $p->id,
|
||||||
|
'UserName' => $p->username,
|
||||||
|
'Name' => $p->name,
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json($profiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user
|
||||||
|
*
|
||||||
|
* Returns a JSON array of all the smartdok users registered on the system
|
||||||
|
*
|
||||||
|
* @param $id
|
||||||
|
*
|
||||||
|
* Example response:
|
||||||
|
* {
|
||||||
|
* "Id": "00000000-0000-0000-0000-000000000000",
|
||||||
|
* "UserName": "string",
|
||||||
|
* "Name": "string"
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
public function show(string $id) {
|
||||||
|
$p = SmartdokProfile::findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'Id' => $p->id,
|
||||||
|
'UserName' => $p->username,
|
||||||
|
'Name' => $p->name,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
70
app/Http/Controllers/Api/WorkHourController.php
Normal file
70
app/Http/Controllers/Api/WorkHourController.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
use App\Models\WorkHour;
|
||||||
|
|
||||||
|
class WorkHourController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* GET /WorkHours
|
||||||
|
*
|
||||||
|
* Required query params:
|
||||||
|
* - fromDate : date-time (filters work_date >= fromDate)
|
||||||
|
* - toDate : date-time (filters work_date <= toDate)
|
||||||
|
* Optional query param:
|
||||||
|
* - projectId : integer (filters by associated project)
|
||||||
|
*
|
||||||
|
* @response \App\Models\WorkHour
|
||||||
|
*/
|
||||||
|
public function index(Request $request) {
|
||||||
|
$request->validate([
|
||||||
|
'fromDate' => 'required|date',
|
||||||
|
'toDate' => 'required|date',
|
||||||
|
'projectId' => 'nullable|integer',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$from = Carbon::parse($request->query('fromDate'))
|
||||||
|
->startOfDay()
|
||||||
|
->toDateTimeString(); // “2025-05-12 00:00:00”
|
||||||
|
|
||||||
|
$to = Carbon::parse($request->query('toDate'))
|
||||||
|
->endOfDay()
|
||||||
|
->toDateTimeString(); // “2025-05-12 23:59:59”
|
||||||
|
|
||||||
|
$q = WorkHour::with('project.departments')
|
||||||
|
->whereBetween('work_date', [$from, $to]);
|
||||||
|
|
||||||
|
if ($pid = $request->query('projectId')) {
|
||||||
|
// filter directly on the foreign key
|
||||||
|
$q->where('project_id', $pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $q->get()->map(function (WorkHour $w) {
|
||||||
|
$deptIds = $w->project
|
||||||
|
->departments
|
||||||
|
->pluck('id')
|
||||||
|
->unique()
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'WorkHourID' => $w->id,
|
||||||
|
'UserID' => $w->user_id,
|
||||||
|
'ProjectID' => $w->project_id,
|
||||||
|
'OrdinaryHours' => $w->ordinary_hours,
|
||||||
|
'Date' => $w->work_date->toDateString(),
|
||||||
|
'Comment' => $w->comment,
|
||||||
|
'DepartmentIDsProject' => $deptIds,
|
||||||
|
'Updated' => $w->updated_at->toIso8601String() . 'Z',
|
||||||
|
'Created' => $w->created_at->toIso8601String() . 'Z',
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
return response()->json($result);
|
||||||
|
}
|
||||||
|
}
|
87
app/Http/Controllers/ApiAdminController.php
Normal file
87
app/Http/Controllers/ApiAdminController.php
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
|
use App\Models\ApiAdmins;
|
||||||
|
use App\Models\ApiKeys;
|
||||||
|
|
||||||
|
class ApiAdminController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request) {
|
||||||
|
$userId = Auth::id();
|
||||||
|
|
||||||
|
$isAdmin = ApiAdmins::where('user_id', $userId)->exists();
|
||||||
|
|
||||||
|
$categories = Apikeys::select('id', 'category')
|
||||||
|
->orderBy('category')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return Inertia::render('Dashboard', [
|
||||||
|
'isAdmin' => $isAdmin,
|
||||||
|
'categories' => $categories,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create() {
|
||||||
|
$userId = Auth::id();
|
||||||
|
$isAdmin = ApiAdmins::where('user_id', $userId)->exists();
|
||||||
|
|
||||||
|
if (! $isAdmin) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$raw = config('api_key_categories', []);
|
||||||
|
$categories = collect($raw)
|
||||||
|
->map(fn($desc, $key) => ['key' => $key, 'description' => $desc])
|
||||||
|
->values()
|
||||||
|
->all();
|
||||||
|
|
||||||
|
return Inertia::render('ApiKeys/Add', [
|
||||||
|
'categories' => $categories,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request) {
|
||||||
|
$userId = Auth::id();
|
||||||
|
$isAdmin = ApiAdmins::where('user_id', $userId)->exists();
|
||||||
|
|
||||||
|
if (! $isAdmin) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = $request->validate([
|
||||||
|
'category' => 'required|string|unique:apikeys,category',
|
||||||
|
'key' => 'required|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Apikeys::create([
|
||||||
|
'category' => $data['category'],
|
||||||
|
'key' => $data['key'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('dashboard')
|
||||||
|
->with('success', 'API‐key category added.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(int $id) {
|
||||||
|
$userId = Auth::id();
|
||||||
|
$isAdmin = ApiAdmins::where('user_id', $userId)->exists();
|
||||||
|
|
||||||
|
if (! $isAdmin) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to find the record—404 if not found
|
||||||
|
$apiKey = Apikeys::findOrFail($id);
|
||||||
|
$apiKey->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('dashboard')
|
||||||
|
->with('success', 'API‐key category removed.');
|
||||||
|
}
|
||||||
|
}
|
51
app/Http/Controllers/Auth/AuthenticatedSessionController.php
Normal file
51
app/Http/Controllers/Auth/AuthenticatedSessionController.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Auth\LoginRequest;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class AuthenticatedSessionController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the login page.
|
||||||
|
*/
|
||||||
|
public function create(Request $request): Response
|
||||||
|
{
|
||||||
|
return Inertia::render('auth/Login', [
|
||||||
|
'canResetPassword' => Route::has('password.request'),
|
||||||
|
'status' => $request->session()->get('status'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming authentication request.
|
||||||
|
*/
|
||||||
|
public function store(LoginRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->authenticate();
|
||||||
|
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy an authenticated session.
|
||||||
|
*/
|
||||||
|
public function destroy(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
Auth::guard('web')->logout();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return redirect('/');
|
||||||
|
}
|
||||||
|
}
|
41
app/Http/Controllers/Auth/ConfirmablePasswordController.php
Normal file
41
app/Http/Controllers/Auth/ConfirmablePasswordController.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class ConfirmablePasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the confirm password page.
|
||||||
|
*/
|
||||||
|
public function show(): Response
|
||||||
|
{
|
||||||
|
return Inertia::render('auth/ConfirmPassword');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm the user's password.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if (! Auth::guard('web')->validate([
|
||||||
|
'email' => $request->user()->email,
|
||||||
|
'password' => $request->password,
|
||||||
|
])) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'password' => __('auth.password'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->session()->put('auth.password_confirmed_at', time());
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EmailVerificationNotificationController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Send a new email verification notification.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
return back()->with('status', 'verification-link-sent');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class EmailVerificationPromptController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the email verification prompt page.
|
||||||
|
*/
|
||||||
|
public function __invoke(Request $request): RedirectResponse|Response
|
||||||
|
{
|
||||||
|
return $request->user()->hasVerifiedEmail()
|
||||||
|
? redirect()->intended(route('dashboard', absolute: false))
|
||||||
|
: Inertia::render('auth/VerifyEmail', ['status' => $request->session()->get('status')]);
|
||||||
|
}
|
||||||
|
}
|
69
app/Http/Controllers/Auth/NewPasswordController.php
Normal file
69
app/Http/Controllers/Auth/NewPasswordController.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Auth\Events\PasswordReset;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class NewPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the password reset page.
|
||||||
|
*/
|
||||||
|
public function create(Request $request): Response
|
||||||
|
{
|
||||||
|
return Inertia::render('auth/ResetPassword', [
|
||||||
|
'email' => $request->email,
|
||||||
|
'token' => $request->route('token'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming new password request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'token' => 'required',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Here we will attempt to reset the user's password. If it is successful we
|
||||||
|
// will update the password on an actual user model and persist it to the
|
||||||
|
// database. Otherwise we will parse the error and return the response.
|
||||||
|
$status = Password::reset(
|
||||||
|
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||||
|
function ($user) use ($request) {
|
||||||
|
$user->forceFill([
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'remember_token' => Str::random(60),
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
event(new PasswordReset($user));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// If the password was successfully reset, we will redirect the user back to
|
||||||
|
// the application's home authenticated view. If there is an error we can
|
||||||
|
// redirect them back to where they came from with their error message.
|
||||||
|
if ($status == Password::PasswordReset) {
|
||||||
|
return to_route('login')->with('status', __($status));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => [__($status)],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
41
app/Http/Controllers/Auth/PasswordResetLinkController.php
Normal file
41
app/Http/Controllers/Auth/PasswordResetLinkController.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class PasswordResetLinkController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the password reset link request page.
|
||||||
|
*/
|
||||||
|
public function create(Request $request): Response
|
||||||
|
{
|
||||||
|
return Inertia::render('auth/ForgotPassword', [
|
||||||
|
'status' => $request->session()->get('status'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming password reset link request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => 'required|email',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Password::sendResetLink(
|
||||||
|
$request->only('email')
|
||||||
|
);
|
||||||
|
|
||||||
|
return back()->with('status', __('A reset link will be sent if the account exists.'));
|
||||||
|
}
|
||||||
|
}
|
51
app/Http/Controllers/Auth/RegisteredUserController.php
Normal file
51
app/Http/Controllers/Auth/RegisteredUserController.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class RegisteredUserController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the registration page.
|
||||||
|
*/
|
||||||
|
public function create(): Response
|
||||||
|
{
|
||||||
|
return Inertia::render('auth/Register');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming registration request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
'email' => 'required|string|lowercase|email|max:255|unique:'.User::class,
|
||||||
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'email' => $request->email,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
event(new Registered($user));
|
||||||
|
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
|
return to_route('dashboard');
|
||||||
|
}
|
||||||
|
}
|
29
app/Http/Controllers/Auth/VerifyEmailController.php
Normal file
29
app/Http/Controllers/Auth/VerifyEmailController.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
|
||||||
|
class VerifyEmailController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Mark the authenticated user's email address as verified.
|
||||||
|
*/
|
||||||
|
public function __invoke(EmailVerificationRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->user()->markEmailAsVerified()) {
|
||||||
|
/** @var \Illuminate\Contracts\Auth\MustVerifyEmail $user */
|
||||||
|
$user = $request->user();
|
||||||
|
event(new Verified($user));
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
|
||||||
|
}
|
||||||
|
}
|
8
app/Http/Controllers/Controller.php
Normal file
8
app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
abstract class Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
108
app/Http/Controllers/DepartmentController.php
Normal file
108
app/Http/Controllers/DepartmentController.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
|
use App\Models\Department;
|
||||||
|
|
||||||
|
class DepartmentController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(Request $request) {
|
||||||
|
$departments = Department::orderBy('name')
|
||||||
|
->paginate(10)
|
||||||
|
->through(fn($dept) => [
|
||||||
|
'id' => $dept->id,
|
||||||
|
'name' => $dept->name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return Inertia::render('Department/Index', [
|
||||||
|
'departments' => $departments,
|
||||||
|
'filters' => $request->only(['page']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create() {
|
||||||
|
return Inertia::render('Department/Create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request) {
|
||||||
|
$data = $request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
Department::create($data);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.departments.index')
|
||||||
|
->with('success', 'Department created successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(string $id) {
|
||||||
|
$department = Department::findOrFail($id);
|
||||||
|
|
||||||
|
return Inertia::render('Department/Show', [
|
||||||
|
'department' => [
|
||||||
|
'id' => $department->id,
|
||||||
|
'name' => $department->name,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(string $id) {
|
||||||
|
$department = Department::findOrFail($id);
|
||||||
|
|
||||||
|
return Inertia::render('Department/Edit', [
|
||||||
|
'department' => [
|
||||||
|
'id' => $department->id,
|
||||||
|
'name' => $department->name,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, string $id) {
|
||||||
|
$department = Department::findOrFail($id);
|
||||||
|
|
||||||
|
$data = $request->validate([
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$department->update($data);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.departments.index')
|
||||||
|
->with('success', 'Department updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(string $id) {
|
||||||
|
$department = Department::findOrFail($id);
|
||||||
|
$department->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.departments.index')
|
||||||
|
->with('success', 'Department deleted successfully.');
|
||||||
|
}
|
||||||
|
}
|
171
app/Http/Controllers/ProjectController.php
Normal file
171
app/Http/Controllers/ProjectController.php
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
|
use App\Models\Project;
|
||||||
|
use App\Models\SmartdokProfile;
|
||||||
|
use App\Models\Department;
|
||||||
|
|
||||||
|
class ProjectController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(Request $request) {
|
||||||
|
$projects = Project::with(['profiles', 'departments'])
|
||||||
|
->orderBy('project_name')
|
||||||
|
->paginate(10)
|
||||||
|
->through(fn($project) => [
|
||||||
|
'id' => $project->id,
|
||||||
|
'project_name' => $project->project_name,
|
||||||
|
'project_number' => $project->project_number,
|
||||||
|
'user_ids' => $project->profiles->pluck('id'),
|
||||||
|
'department_ids' => $project->departments->pluck('id'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return Inertia::render('Project/Index', [
|
||||||
|
'projects' => $projects,
|
||||||
|
'filters' => $request->only(['page']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create() {
|
||||||
|
$profiles = SmartdokProfile::orderBy('name')
|
||||||
|
->get()
|
||||||
|
->map(fn($p) => ['id' => $p->id, 'name' => $p->name]);
|
||||||
|
|
||||||
|
$departments = Department::orderBy('name')
|
||||||
|
->get()
|
||||||
|
->map(fn($d) => ['id' => $d->id, 'name' => $d->name]);
|
||||||
|
|
||||||
|
return Inertia::render('Project/Create', [
|
||||||
|
'profiles' => $profiles,
|
||||||
|
'departments' => $departments,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request) {
|
||||||
|
$data = $request->validate([
|
||||||
|
'project_name' => 'required|string|max:255',
|
||||||
|
'project_number' => 'required|string|max:255|unique:projects,project_number',
|
||||||
|
'user_ids' => 'sometimes|array',
|
||||||
|
'user_ids.*' => 'uuid|exists:smartdok_profiles,id',
|
||||||
|
'department_ids' => 'sometimes|array',
|
||||||
|
'department_ids.*' => 'integer|exists:departments,id',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$project = Project::create([
|
||||||
|
'project_name' => $data['project_name'],
|
||||||
|
'project_number' => $data['project_number'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$project->profiles()->sync($data['user_ids'] ?? []);
|
||||||
|
$project->departments()->sync($data['department_ids'] ?? []);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.projects.index')
|
||||||
|
->with('success', 'Project created successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(string $id) {
|
||||||
|
$project = Project::with(['profiles', 'departments'])->findOrFail($id);
|
||||||
|
|
||||||
|
return Inertia::render('Project/Show', [
|
||||||
|
'project' => [
|
||||||
|
'id' => $project->id,
|
||||||
|
'project_name' => $project->project_name,
|
||||||
|
'project_number' => $project->project_number,
|
||||||
|
'profiles' => $project->profiles->map(fn ($p) => [
|
||||||
|
'id' => $p->id,
|
||||||
|
'username' => $p->username,
|
||||||
|
'name' => $p->name,
|
||||||
|
]),
|
||||||
|
'departments' => $project->departments->map(fn ($d) => [
|
||||||
|
'id' => $d->id,
|
||||||
|
'name' => $d->name,
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(string $id) {
|
||||||
|
$project = Project::with(['profiles', 'departments'])
|
||||||
|
->findOrFail($id);
|
||||||
|
|
||||||
|
$profiles = SmartdokProfile::orderBy('name')
|
||||||
|
->get()
|
||||||
|
->map(fn($p) => ['id' => $p->id, 'name' => $p->name]);
|
||||||
|
|
||||||
|
$departments = Department::orderBy('name')
|
||||||
|
->get()
|
||||||
|
->map(fn($d) => ['id' => $d->id, 'name' => $d->name]);
|
||||||
|
|
||||||
|
return Inertia::render('Project/Edit', [
|
||||||
|
'project' => [
|
||||||
|
'id' => $project->id,
|
||||||
|
'project_name' => $project->project_name,
|
||||||
|
'project_number' => $project->project_number,
|
||||||
|
// ensure these are plain arrays, not Collections
|
||||||
|
'user_ids' => $project->profiles->pluck('id')->all(),
|
||||||
|
'department_ids' => $project->departments->pluck('id')->all(),
|
||||||
|
],
|
||||||
|
'profiles' => $profiles,
|
||||||
|
'departments' => $departments,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, string $id) {
|
||||||
|
$project = Project::findOrFail($id);
|
||||||
|
|
||||||
|
$data = $request->validate([
|
||||||
|
'project_name' => 'required|string|max:255',
|
||||||
|
'project_number' => 'required|string|max:255|unique:projects,project_number,' . $project->id,
|
||||||
|
'user_ids' => 'sometimes|array',
|
||||||
|
'user_ids.*' => 'uuid|exists:smartdok_profiles,id',
|
||||||
|
'department_ids' => 'sometimes|array',
|
||||||
|
'department_ids.*' => 'integer|exists:departments,id',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$project->update([
|
||||||
|
'project_name' => $data['project_name'],
|
||||||
|
'project_number' => $data['project_number'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$project->profiles()->sync($data['user_ids'] ?? []);
|
||||||
|
$project->departments()->sync($data['department_ids'] ?? []);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.projects.index')
|
||||||
|
->with('success', 'Project updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(string $id) {
|
||||||
|
$project = Project::findOrFail($id);
|
||||||
|
$project->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.projects.index')
|
||||||
|
->with('success', 'Project deleted successfully.');
|
||||||
|
}
|
||||||
|
}
|
39
app/Http/Controllers/Settings/PasswordController.php
Normal file
39
app/Http/Controllers/Settings/PasswordController.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Settings;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class PasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the user's password settings page.
|
||||||
|
*/
|
||||||
|
public function edit(): Response
|
||||||
|
{
|
||||||
|
return Inertia::render('settings/Password');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the user's password.
|
||||||
|
*/
|
||||||
|
public function update(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validate([
|
||||||
|
'current_password' => ['required', 'current_password'],
|
||||||
|
'password' => ['required', Password::defaults(), 'confirmed'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request->user()->update([
|
||||||
|
'password' => Hash::make($validated['password']),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
}
|
63
app/Http/Controllers/Settings/ProfileController.php
Normal file
63
app/Http/Controllers/Settings/ProfileController.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Settings;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Settings\ProfileUpdateRequest;
|
||||||
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
use Inertia\Response;
|
||||||
|
|
||||||
|
class ProfileController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the user's profile settings page.
|
||||||
|
*/
|
||||||
|
public function edit(Request $request): Response
|
||||||
|
{
|
||||||
|
return Inertia::render('settings/Profile', [
|
||||||
|
'mustVerifyEmail' => $request->user() instanceof MustVerifyEmail,
|
||||||
|
'status' => $request->session()->get('status'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the user's profile information.
|
||||||
|
*/
|
||||||
|
public function update(ProfileUpdateRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->user()->fill($request->validated());
|
||||||
|
|
||||||
|
if ($request->user()->isDirty('email')) {
|
||||||
|
$request->user()->email_verified_at = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->save();
|
||||||
|
|
||||||
|
return to_route('profile.edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the user's profile.
|
||||||
|
*/
|
||||||
|
public function destroy(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'password' => ['required', 'current_password'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = $request->user();
|
||||||
|
|
||||||
|
Auth::logout();
|
||||||
|
|
||||||
|
$user->delete();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return redirect('/');
|
||||||
|
}
|
||||||
|
}
|
116
app/Http/Controllers/SmartdokProfileController.php
Normal file
116
app/Http/Controllers/SmartdokProfileController.php
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
|
use App\Models\SmartdokProfile;
|
||||||
|
|
||||||
|
class SmartdokProfileController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(Request $request) {
|
||||||
|
$profiles = SmartdokProfile::orderBy('name')
|
||||||
|
->paginate(10)
|
||||||
|
->through(fn($profile) => [
|
||||||
|
'id' => $profile->id,
|
||||||
|
'username' => $profile->username,
|
||||||
|
'name' => $profile->name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return Inertia::render('SmartDokProfile/Index', [
|
||||||
|
'profiles' => $profiles,
|
||||||
|
'filters' => $request->only(['search', 'page']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create() {
|
||||||
|
return Inertia::render('SmartDokProfile/Create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request) {
|
||||||
|
$data = $request->validate([
|
||||||
|
'username' => 'required|string|max:255|unique:smartdok_profiles,username',
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// generate a UUID for the new profile
|
||||||
|
$data['id'] = (string) Str::uuid();
|
||||||
|
|
||||||
|
SmartdokProfile::create($data);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.profiles.index')
|
||||||
|
->with('success', 'Profile created successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(string $id) {
|
||||||
|
$profile = SmartdokProfile::findOrFail($id);
|
||||||
|
|
||||||
|
return Inertia::render('SmartDokProfile/Show', [
|
||||||
|
'profile' => [
|
||||||
|
'id' => $profile->id,
|
||||||
|
'username' => $profile->username,
|
||||||
|
'name' => $profile->name,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(string $id) {
|
||||||
|
$profile = SmartdokProfile::findOrFail($id);
|
||||||
|
|
||||||
|
return Inertia::render('SmartDokProfile/Edit', [
|
||||||
|
'profile' => [
|
||||||
|
'id' => $profile->id,
|
||||||
|
'username' => $profile->username,
|
||||||
|
'name' => $profile->name,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, string $id) {
|
||||||
|
$profile = SmartdokProfile::findOrFail($id);
|
||||||
|
|
||||||
|
$data = $request->validate([
|
||||||
|
'username' => 'required|string|max:255|unique:smartdok_profiles,username,' . $profile->id,
|
||||||
|
'name' => 'required|string|max:255',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$profile->update($data);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.profiles.index')
|
||||||
|
->with('success', 'Profile updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(string $id) {
|
||||||
|
$profile = SmartdokProfile::findOrFail($id);
|
||||||
|
$profile->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.profiles.index')
|
||||||
|
->with('success', 'Profile deleted successfully.');
|
||||||
|
}
|
||||||
|
}
|
168
app/Http/Controllers/WorkHourController.php
Normal file
168
app/Http/Controllers/WorkHourController.php
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Inertia\Inertia;
|
||||||
|
|
||||||
|
use App\Models\WorkHour;
|
||||||
|
use App\Models\SmartdokProfile;
|
||||||
|
use App\Models\Project;
|
||||||
|
|
||||||
|
class WorkHourController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(Request $request) {
|
||||||
|
$workHours = WorkHour::with(['user', 'project'])
|
||||||
|
->orderBy('created_at', 'desc')
|
||||||
|
->paginate(10)
|
||||||
|
->through(fn($wh) => [
|
||||||
|
'id' => $wh->id,
|
||||||
|
'user_id' => $wh->user_id,
|
||||||
|
'user_name' => $wh->user->name,
|
||||||
|
'ordinary_hours' => $wh->ordinary_hours,
|
||||||
|
'work_date' => $wh->work_date->toDateString(),
|
||||||
|
'comment' => $wh->comment,
|
||||||
|
'project_id' => $wh->project_id,
|
||||||
|
'project_name' => $wh->project->project_name,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return Inertia::render('WorkHour/Index', [
|
||||||
|
'workHours' => $workHours,
|
||||||
|
'filters' => $request->only(['page']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create() {
|
||||||
|
$profiles = SmartdokProfile::orderBy('name')
|
||||||
|
->get()
|
||||||
|
->map(fn($p) => ['id' => $p->id, 'name' => $p->name]);
|
||||||
|
|
||||||
|
$projects = Project::orderBy('project_name')
|
||||||
|
->get()
|
||||||
|
->map(fn($proj) => ['id' => $proj->id, 'project_name' => $proj->project_name]);
|
||||||
|
|
||||||
|
return Inertia::render('WorkHour/Create', [
|
||||||
|
'profiles' => $profiles,
|
||||||
|
'projects' => $projects,
|
||||||
|
'today' => now()->toDateString(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request) {
|
||||||
|
$data = $request->validate([
|
||||||
|
'user_id' => 'required|uuid|exists:smartdok_profiles,id',
|
||||||
|
'project_id' => 'required|integer|exists:projects,id',
|
||||||
|
'ordinary_hours' => 'required|numeric|min:0.5|multiple_of:0.5',
|
||||||
|
'work_date' => 'required|date',
|
||||||
|
'comment' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
WorkHour::create([
|
||||||
|
'user_id' => $data['user_id'],
|
||||||
|
'project_id' => $data['project_id'],
|
||||||
|
'ordinary_hours' => $data['ordinary_hours'],
|
||||||
|
'work_date' => $data['work_date'],
|
||||||
|
'comment' => $data['comment'] ?? null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.work-hours.index')
|
||||||
|
->with('success', 'Work hour entry created successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(string $id) {
|
||||||
|
$wh = WorkHour::with(['user', 'project'])->findOrFail($id);
|
||||||
|
|
||||||
|
return Inertia::render('WorkHour/Show', [
|
||||||
|
'workHour' => [
|
||||||
|
'id' => $wh->id,
|
||||||
|
'user_id' => $wh->user_id,
|
||||||
|
'user_name' => $wh->user->name,
|
||||||
|
'ordinary_hours' => $wh->ordinary_hours,
|
||||||
|
'work_date' => $wh->work_date->toDateString(),
|
||||||
|
'comment' => $wh->comment,
|
||||||
|
'project_id' => $wh->project_id,
|
||||||
|
'project_name' => $wh->project->project_name,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(string $id) {
|
||||||
|
$wh = WorkHour::with(['user', 'project'])->findOrFail($id);
|
||||||
|
|
||||||
|
$profiles = SmartdokProfile::orderBy('name')
|
||||||
|
->get()
|
||||||
|
->map(fn($p) => ['id' => $p->id, 'name' => $p->name]);
|
||||||
|
|
||||||
|
$projects = Project::orderBy('project_name')
|
||||||
|
->get()
|
||||||
|
->map(fn($proj) => ['id' => $proj->id, 'project_name' => $proj->project_name]);
|
||||||
|
|
||||||
|
return Inertia::render('WorkHour/Edit', [
|
||||||
|
'workHour' => [
|
||||||
|
'id' => $wh->id,
|
||||||
|
'user_id' => $wh->user_id,
|
||||||
|
'ordinary_hours' => $wh->ordinary_hours,
|
||||||
|
'work_date' => $wh->work_date->toDateString(),
|
||||||
|
'comment' => $wh->comment,
|
||||||
|
'project_id' => $wh->project_id,
|
||||||
|
],
|
||||||
|
'profiles' => $profiles,
|
||||||
|
'projects' => $projects,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, string $id) {
|
||||||
|
$wh = WorkHour::findOrFail($id);
|
||||||
|
|
||||||
|
$data = $request->validate([
|
||||||
|
'user_id' => 'required|uuid|exists:smartdok_profiles,id',
|
||||||
|
'project_id' => 'required|integer|exists:projects,id',
|
||||||
|
'ordinary_hours' => 'required|numeric|decimal:1|min:0.5',
|
||||||
|
'work_date' => 'required|date',
|
||||||
|
'comment' => 'nullable|string',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$wh->update([
|
||||||
|
'user_id' => $data['user_id'],
|
||||||
|
'project_id' => $data['project_id'],
|
||||||
|
'ordinary_hours' => $data['ordinary_hours'],
|
||||||
|
'work_date' => $data['work_date'],
|
||||||
|
'comment' => $data['comment'] ?? null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.work-hours.index')
|
||||||
|
->with('success', 'Work hour entry updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(string $id) {
|
||||||
|
WorkHour::findOrFail($id)->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('smartdok.work-hours.index')
|
||||||
|
->with('success', 'Work hour entry deleted successfully.');
|
||||||
|
}
|
||||||
|
}
|
23
app/Http/Middleware/HandleAppearance.php
Normal file
23
app/Http/Middleware/HandleAppearance.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\View;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class HandleAppearance
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
View::share('appearance', $request->cookie('appearance') ?? 'system');
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
56
app/Http/Middleware/HandleInertiaRequests.php
Normal file
56
app/Http/Middleware/HandleInertiaRequests.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Inspiring;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Inertia\Middleware;
|
||||||
|
use Tighten\Ziggy\Ziggy;
|
||||||
|
|
||||||
|
class HandleInertiaRequests extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The root template that's loaded on the first page visit.
|
||||||
|
*
|
||||||
|
* @see https://inertiajs.com/server-side-setup#root-template
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $rootView = 'app';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the current asset version.
|
||||||
|
*
|
||||||
|
* @see https://inertiajs.com/asset-versioning
|
||||||
|
*/
|
||||||
|
public function version(Request $request): ?string
|
||||||
|
{
|
||||||
|
return parent::version($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the props that are shared by default.
|
||||||
|
*
|
||||||
|
* @see https://inertiajs.com/shared-data
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function share(Request $request): array
|
||||||
|
{
|
||||||
|
[$message, $author] = str(Inspiring::quotes()->random())->explode('-');
|
||||||
|
|
||||||
|
return [
|
||||||
|
...parent::share($request),
|
||||||
|
'name' => config('app.name'),
|
||||||
|
'quote' => ['message' => trim($message), 'author' => trim($author)],
|
||||||
|
'auth' => [
|
||||||
|
'user' => $request->user(),
|
||||||
|
],
|
||||||
|
'ziggy' => [
|
||||||
|
...(new Ziggy)->toArray(),
|
||||||
|
'location' => $request->url(),
|
||||||
|
],
|
||||||
|
'sidebarOpen' => ! $request->hasCookie('sidebar_state') || $request->cookie('sidebar_state') === 'true',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
85
app/Http/Requests/Auth/LoginRequest.php
Normal file
85
app/Http/Requests/Auth/LoginRequest.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Lockout;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
|
class LoginRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => ['required', 'string', 'email'],
|
||||||
|
'password' => ['required', 'string'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to authenticate the request's credentials.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function authenticate(): void
|
||||||
|
{
|
||||||
|
$this->ensureIsNotRateLimited();
|
||||||
|
|
||||||
|
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
|
||||||
|
RateLimiter::hit($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.failed'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
RateLimiter::clear($this->throttleKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure the login request is not rate limited.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function ensureIsNotRateLimited(): void
|
||||||
|
{
|
||||||
|
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event(new Lockout($this));
|
||||||
|
|
||||||
|
$seconds = RateLimiter::availableIn($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.throttle', [
|
||||||
|
'seconds' => $seconds,
|
||||||
|
'minutes' => ceil($seconds / 60),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the rate limiting throttle key for the request.
|
||||||
|
*/
|
||||||
|
public function throttleKey(): string
|
||||||
|
{
|
||||||
|
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
|
||||||
|
}
|
||||||
|
}
|
30
app/Http/Requests/Settings/ProfileUpdateRequest.php
Normal file
30
app/Http/Requests/Settings/ProfileUpdateRequest.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Settings;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class ProfileUpdateRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => ['required', 'string', 'max:255'],
|
||||||
|
'email' => [
|
||||||
|
'required',
|
||||||
|
'string',
|
||||||
|
'lowercase',
|
||||||
|
'email',
|
||||||
|
'max:255',
|
||||||
|
Rule::unique(User::class)->ignore($this->user()->id),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
23
app/Models/ApiAdmins.php
Normal file
23
app/Models/ApiAdmins.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class ApiAdmins extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'apiadmins';
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function user(): BelongsTo {
|
||||||
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
|
}
|
||||||
|
}
|
17
app/Models/ApiKeys.php
Normal file
17
app/Models/ApiKeys.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ApiKeys extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'apikeys';
|
||||||
|
protected $fillable = [
|
||||||
|
'category',
|
||||||
|
'key'
|
||||||
|
];
|
||||||
|
}
|
28
app/Models/Department.php
Normal file
28
app/Models/Department.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
|
class Department extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The projects that belong to the department.
|
||||||
|
*/
|
||||||
|
public function projects(): BelongsToMany {
|
||||||
|
return $this->belongsToMany(
|
||||||
|
Project::class,
|
||||||
|
'department_project',
|
||||||
|
'department_id',
|
||||||
|
'project_id'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
49
app/Models/Project.php
Normal file
49
app/Models/Project.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
class Project extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'project_name',
|
||||||
|
'project_number',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The profiles associated with this project.
|
||||||
|
*/
|
||||||
|
public function profiles(): BelongsToMany {
|
||||||
|
return $this->belongsToMany(
|
||||||
|
SmartdokProfile::class,
|
||||||
|
'project_smartdok_profile',
|
||||||
|
'project_id',
|
||||||
|
'smartdok_profile_id'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The departments associated with this project.
|
||||||
|
*/
|
||||||
|
public function departments(): BelongsToMany {
|
||||||
|
return $this->belongsToMany(
|
||||||
|
Department::class,
|
||||||
|
'department_project',
|
||||||
|
'project_id',
|
||||||
|
'department_id'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The work hours entries linked to this project.
|
||||||
|
*/
|
||||||
|
public function workHours(): HasMany {
|
||||||
|
return $this->hasMany(WorkHour::class, 'project_id');
|
||||||
|
}
|
||||||
|
}
|
42
app/Models/SmartdokProfile.php
Normal file
42
app/Models/SmartdokProfile.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
class SmartdokProfile extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'smartdok_profiles';
|
||||||
|
public $incrementing = false;
|
||||||
|
protected $keyType = 'string';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'id',
|
||||||
|
'username',
|
||||||
|
'name',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The projects that belong to the profile.
|
||||||
|
*/
|
||||||
|
public function projects(): BelongsToMany {
|
||||||
|
return $this->belongsToMany(
|
||||||
|
Project::class,
|
||||||
|
'project_smartdok_profile',
|
||||||
|
'smartdok_profile_id',
|
||||||
|
'project_id'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The work hours entries for the profile.
|
||||||
|
*/
|
||||||
|
public function workHours(): HasMany {
|
||||||
|
return $this->hasMany(WorkHour::class, 'user_id', 'id');
|
||||||
|
}
|
||||||
|
}
|
55
app/Models/User.php
Normal file
55
app/Models/User.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
|
||||||
|
use App\Models\ApiAdmins;
|
||||||
|
|
||||||
|
class User extends Authenticatable
|
||||||
|
{
|
||||||
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||||
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'password',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be hidden for serialization.
|
||||||
|
*
|
||||||
|
* @var list<string>
|
||||||
|
*/
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
'remember_token',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
protected function casts(): array {
|
||||||
|
return [
|
||||||
|
'email_verified_at' => 'datetime',
|
||||||
|
'password' => 'hashed',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function apiAdmin(): HasOne {
|
||||||
|
return $this->hasOne(ApiAdmins::class, 'user_id');
|
||||||
|
}
|
||||||
|
}
|
41
app/Models/WorkHour.php
Normal file
41
app/Models/WorkHour.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
|
class WorkHour extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $table = 'work_hours';
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'project_id',
|
||||||
|
'ordinary_hours',
|
||||||
|
'work_date',
|
||||||
|
'comment'
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'work_date' => 'date',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The profile that owns the work hour entry.
|
||||||
|
*/
|
||||||
|
public function user(): BelongsTo {
|
||||||
|
return $this->belongsTo(SmartdokProfile::class, 'user_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The project linked to this work hour entry.
|
||||||
|
*/
|
||||||
|
public function project(): BelongsTo {
|
||||||
|
return $this->belongsTo(Project::class, 'project_id');
|
||||||
|
}
|
||||||
|
}
|
31
app/Providers/AppServiceProvider.php
Normal file
31
app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
use Dedoc\Scramble\Scramble;
|
||||||
|
use Dedoc\Scramble\Support\Generator\OpenApi;
|
||||||
|
use Dedoc\Scramble\Support\Generator\SecurityScheme;
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*/
|
||||||
|
public function register(): void {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void {
|
||||||
|
Scramble::configure()
|
||||||
|
->withDocumentTransformers(function (OpenApi $openApi) {
|
||||||
|
$openApi->secure(
|
||||||
|
SecurityScheme::http('bearer')
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
18
artisan
Normal file
18
artisan
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
// Register the Composer autoloader...
|
||||||
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
|
// Bootstrap Laravel and handle the command...
|
||||||
|
/** @var Application $app */
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
$status = $app->handleCommand(new ArgvInput);
|
||||||
|
|
||||||
|
exit($status);
|
28
bootstrap/app.php
Normal file
28
bootstrap/app.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Http\Middleware\HandleAppearance;
|
||||||
|
use App\Http\Middleware\HandleInertiaRequests;
|
||||||
|
use Illuminate\Foundation\Application;
|
||||||
|
use Illuminate\Foundation\Configuration\Exceptions;
|
||||||
|
use Illuminate\Foundation\Configuration\Middleware;
|
||||||
|
use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
|
||||||
|
|
||||||
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
|
->withRouting(
|
||||||
|
web: __DIR__.'/../routes/web.php',
|
||||||
|
api: __DIR__.'/../routes/api.php',
|
||||||
|
commands: __DIR__.'/../routes/console.php',
|
||||||
|
health: '/up',
|
||||||
|
)
|
||||||
|
->withMiddleware(function (Middleware $middleware) {
|
||||||
|
$middleware->encryptCookies(except: ['appearance', 'sidebar_state']);
|
||||||
|
|
||||||
|
$middleware->web(append: [
|
||||||
|
HandleAppearance::class,
|
||||||
|
HandleInertiaRequests::class,
|
||||||
|
AddLinkHeadersForPreloadedAssets::class,
|
||||||
|
]);
|
||||||
|
})
|
||||||
|
->withExceptions(function (Exceptions $exceptions) {
|
||||||
|
//
|
||||||
|
})->create();
|
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
5
bootstrap/providers.php
Normal file
5
bootstrap/providers.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
];
|
20
components.json
Normal file
20
components.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://shadcn-vue.com/schema.json",
|
||||||
|
"style": "default",
|
||||||
|
"typescript": true,
|
||||||
|
"tailwind": {
|
||||||
|
"config": "tailwind.config.js",
|
||||||
|
"css": "resources/css/app.css",
|
||||||
|
"baseColor": "neutral",
|
||||||
|
"cssVariables": true,
|
||||||
|
"prefix": ""
|
||||||
|
},
|
||||||
|
"aliases": {
|
||||||
|
"components": "@/components",
|
||||||
|
"composables": "@/composables",
|
||||||
|
"utils": "@/lib/utils",
|
||||||
|
"ui": "@/components/ui",
|
||||||
|
"lib": "@/lib"
|
||||||
|
},
|
||||||
|
"iconLibrary": "lucide"
|
||||||
|
}
|
88
composer.json
Normal file
88
composer.json
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://getcomposer.org/schema.json",
|
||||||
|
"name": "laravel/vue-starter-kit",
|
||||||
|
"type": "project",
|
||||||
|
"description": "The skeleton application for the Laravel framework.",
|
||||||
|
"keywords": [
|
||||||
|
"laravel",
|
||||||
|
"framework"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^8.2",
|
||||||
|
"dedoc/scramble": "^0.12.19",
|
||||||
|
"inertiajs/inertia-laravel": "^2.0",
|
||||||
|
"laravel/framework": "^12.0",
|
||||||
|
"laravel/sanctum": "^4.0",
|
||||||
|
"laravel/tinker": "^2.10.1",
|
||||||
|
"tightenco/ziggy": "^2.4"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"fakerphp/faker": "^1.23",
|
||||||
|
"laravel/pail": "^1.2.2",
|
||||||
|
"laravel/pint": "^1.18",
|
||||||
|
"laravel/sail": "^1.41",
|
||||||
|
"mockery/mockery": "^1.6",
|
||||||
|
"nunomaduro/collision": "^8.6",
|
||||||
|
"pestphp/pest": "^3.8",
|
||||||
|
"pestphp/pest-plugin-laravel": "^3.2"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi",
|
||||||
|
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
|
||||||
|
"@php artisan migrate --graceful --ansi"
|
||||||
|
],
|
||||||
|
"dev": [
|
||||||
|
"Composer\\Config::disableProcessTimeout",
|
||||||
|
"npx concurrently -c \"#93c5fd,#c4b5fd,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"npm run dev\" --names='server,queue,vite'"
|
||||||
|
],
|
||||||
|
"dev:ssr": [
|
||||||
|
"npm run build:ssr",
|
||||||
|
"Composer\\Config::disableProcessTimeout",
|
||||||
|
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"php artisan inertia:start-ssr\" --names=server,queue,logs,ssr"
|
||||||
|
],
|
||||||
|
"test": [
|
||||||
|
"@php artisan config:clear --ansi",
|
||||||
|
"@php artisan test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"pestphp/pest-plugin": true,
|
||||||
|
"php-http/discovery": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
9358
composer.lock
generated
Normal file
9358
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
5
config/api_key_categories.php
Normal file
5
config/api_key_categories.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'smartdok' => 'SmartDok'
|
||||||
|
];
|
126
config/app.php
Normal file
126
config/app.php
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value is the name of your application, which will be used when the
|
||||||
|
| framework needs to place the application's name in a notification or
|
||||||
|
| other UI elements where an application name needs to be displayed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'name' => env('APP_NAME', 'Test API'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Environment
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value determines the "environment" your application is currently
|
||||||
|
| running in. This may determine how you prefer to configure various
|
||||||
|
| services the application utilizes. Set this in your ".env" file.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'env' => env('APP_ENV', 'production'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Debug Mode
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When your application is in debug mode, detailed error messages with
|
||||||
|
| stack traces will be shown on every error that occurs within your
|
||||||
|
| application. If disabled, a simple generic error page is shown.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'debug' => (bool) env('APP_DEBUG', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application URL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This URL is used by the console to properly generate URLs when using
|
||||||
|
| the Artisan command line tool. You should set this to the root of
|
||||||
|
| the application so that it's available within Artisan commands.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Timezone
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default timezone for your application, which
|
||||||
|
| will be used by the PHP date and date-time functions. The timezone
|
||||||
|
| is set to "UTC" by default as it is suitable for most use cases.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Locale Configuration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The application locale determines the default locale that will be used
|
||||||
|
| by Laravel's translation / localization methods. This option can be
|
||||||
|
| set to any locale for which you plan to have translation strings.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'locale' => env('APP_LOCALE', 'no'),
|
||||||
|
|
||||||
|
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||||
|
|
||||||
|
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Encryption Key
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This key is utilized by Laravel's encryption services and should be set
|
||||||
|
| to a random, 32 character string to ensure that all encrypted values
|
||||||
|
| are secure. You should do this prior to deploying the application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
|
'key' => env('APP_KEY'),
|
||||||
|
|
||||||
|
'previous_keys' => [
|
||||||
|
...array_filter(
|
||||||
|
explode(',', env('APP_PREVIOUS_KEYS', ''))
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Maintenance Mode Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These configuration options determine the driver used to determine and
|
||||||
|
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||||
|
| allow maintenance mode to be controlled across multiple machines.
|
||||||
|
|
|
||||||
|
| Supported drivers: "file", "cache"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'maintenance' => [
|
||||||
|
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
|
||||||
|
'store' => env('APP_MAINTENANCE_STORE', 'database'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
115
config/auth.php
Normal file
115
config/auth.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Defaults
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option defines the default authentication "guard" and password
|
||||||
|
| reset "broker" for your application. You may change these values
|
||||||
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => env('AUTH_GUARD', 'web'),
|
||||||
|
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, you may define every authentication guard for your application.
|
||||||
|
| Of course, a great default configuration has been defined for you
|
||||||
|
| which utilizes session storage plus the Eloquent user provider.
|
||||||
|
|
|
||||||
|
| All authentication guards have a user provider, which defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| system used by the application. Typically, Eloquent is utilized.
|
||||||
|
|
|
||||||
|
| Supported: "session"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| User Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| All authentication guards have a user provider, which defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| system used by the application. Typically, Eloquent is utilized.
|
||||||
|
|
|
||||||
|
| If you have multiple user tables or models you may configure multiple
|
||||||
|
| providers to represent the model / table. These providers may then
|
||||||
|
| be assigned to any extra authentication guards you have defined.
|
||||||
|
|
|
||||||
|
| Supported: "database", "eloquent"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
'users' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => env('AUTH_MODEL', App\Models\User::class),
|
||||||
|
],
|
||||||
|
|
||||||
|
// 'users' => [
|
||||||
|
// 'driver' => 'database',
|
||||||
|
// 'table' => 'users',
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Resetting Passwords
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These configuration options specify the behavior of Laravel's password
|
||||||
|
| reset functionality, including the table utilized for token storage
|
||||||
|
| and the user provider that is invoked to actually retrieve users.
|
||||||
|
|
|
||||||
|
| The expiry time is the number of minutes that each reset token will be
|
||||||
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
||||||
|
| The throttle setting is the number of seconds a user must wait before
|
||||||
|
| generating more password reset tokens. This prevents the user from
|
||||||
|
| quickly generating a very large amount of password reset tokens.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'passwords' => [
|
||||||
|
'users' => [
|
||||||
|
'provider' => 'users',
|
||||||
|
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
|
||||||
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Confirmation Timeout
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define the amount of seconds before a password confirmation
|
||||||
|
| window expires and users are asked to re-enter their password via the
|
||||||
|
| confirmation screen. By default, the timeout lasts for three hours.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
|
||||||
|
|
||||||
|
];
|
108
config/cache.php
Normal file
108
config/cache.php
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default cache store that will be used by the
|
||||||
|
| framework. This connection is utilized if another isn't explicitly
|
||||||
|
| specified when running a cache operation inside the application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('CACHE_STORE', 'database'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Stores
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the cache "stores" for your application as
|
||||||
|
| well as their drivers. You may even define multiple stores for the
|
||||||
|
| same cache driver to group types of items stored in your caches.
|
||||||
|
|
|
||||||
|
| Supported drivers: "array", "database", "file", "memcached",
|
||||||
|
| "redis", "dynamodb", "octane", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stores' => [
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'driver' => 'array',
|
||||||
|
'serialize' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'connection' => env('DB_CACHE_CONNECTION'),
|
||||||
|
'table' => env('DB_CACHE_TABLE', 'cache'),
|
||||||
|
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
|
||||||
|
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'file' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
'path' => storage_path('framework/cache/data'),
|
||||||
|
'lock_path' => storage_path('framework/cache/data'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'memcached' => [
|
||||||
|
'driver' => 'memcached',
|
||||||
|
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||||
|
'sasl' => [
|
||||||
|
env('MEMCACHED_USERNAME'),
|
||||||
|
env('MEMCACHED_PASSWORD'),
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||||
|
],
|
||||||
|
'servers' => [
|
||||||
|
[
|
||||||
|
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('MEMCACHED_PORT', 11211),
|
||||||
|
'weight' => 100,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
|
||||||
|
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'dynamodb' => [
|
||||||
|
'driver' => 'dynamodb',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||||
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'octane' => [
|
||||||
|
'driver' => 'octane',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Key Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
|
||||||
|
| stores, there might be other applications using the same cache. For
|
||||||
|
| that reason, you may prefix every cache key to avoid collisions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||||
|
|
||||||
|
];
|
174
config/database.php
Normal file
174
config/database.php
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Database Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify which of the database connections below you wish
|
||||||
|
| to use as your default connection for database operations. This is
|
||||||
|
| the connection which will be utilized unless another connection
|
||||||
|
| is explicitly specified when you execute a query / statement.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Database Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Below are all of the database connections defined for your application.
|
||||||
|
| An example configuration is provided for each database system which
|
||||||
|
| is supported by Laravel. You're free to add / remove connections.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sqlite' => [
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||||
|
'prefix' => '',
|
||||||
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
|
'busy_timeout' => null,
|
||||||
|
'journal_mode' => null,
|
||||||
|
'synchronous' => null,
|
||||||
|
],
|
||||||
|
|
||||||
|
'mysql' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||||
|
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'mariadb' => [
|
||||||
|
'driver' => 'mariadb',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8mb4'),
|
||||||
|
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'pgsql' => [
|
||||||
|
'driver' => 'pgsql',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '5432'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'search_path' => 'public',
|
||||||
|
'sslmode' => 'prefer',
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqlsrv' => [
|
||||||
|
'driver' => 'sqlsrv',
|
||||||
|
'url' => env('DB_URL'),
|
||||||
|
'host' => env('DB_HOST', 'localhost'),
|
||||||
|
'port' => env('DB_PORT', '1433'),
|
||||||
|
'database' => env('DB_DATABASE', 'laravel'),
|
||||||
|
'username' => env('DB_USERNAME', 'root'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => env('DB_CHARSET', 'utf8'),
|
||||||
|
'prefix' => '',
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||||
|
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Migration Repository Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This table keeps track of all the migrations that have already run for
|
||||||
|
| your application. Using this information, we can determine which of
|
||||||
|
| the migrations on disk haven't actually been run on the database.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'migrations' => [
|
||||||
|
'table' => 'migrations',
|
||||||
|
'update_date_on_publish' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Redis Databases
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Redis is an open source, fast, and advanced key-value store that also
|
||||||
|
| provides a richer body of commands than a typical key-value system
|
||||||
|
| such as Memcached. You may define your connection settings here.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
|
||||||
|
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||||
|
|
||||||
|
'options' => [
|
||||||
|
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||||
|
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||||
|
'persistent' => env('REDIS_PERSISTENT', false),
|
||||||
|
],
|
||||||
|
|
||||||
|
'default' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_DB', '0'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'cache' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_CACHE_DB', '1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
80
config/filesystems.php
Normal file
80
config/filesystems.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Filesystem Disk
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default filesystem disk that should be used
|
||||||
|
| by the framework. The "local" disk, as well as a variety of cloud
|
||||||
|
| based disks are available to your application for file storage.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Filesystem Disks
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Below you may configure as many filesystem disks as necessary, and you
|
||||||
|
| may even configure multiple disks for the same driver. Examples for
|
||||||
|
| most supported storage drivers are configured here for reference.
|
||||||
|
|
|
||||||
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'disks' => [
|
||||||
|
|
||||||
|
'local' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/private'),
|
||||||
|
'serve' => true,
|
||||||
|
'throw' => false,
|
||||||
|
'report' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'public' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/public'),
|
||||||
|
'url' => env('APP_URL').'/storage',
|
||||||
|
'visibility' => 'public',
|
||||||
|
'throw' => false,
|
||||||
|
'report' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
's3' => [
|
||||||
|
'driver' => 's3',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
|
'bucket' => env('AWS_BUCKET'),
|
||||||
|
'url' => env('AWS_URL'),
|
||||||
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
|
'throw' => false,
|
||||||
|
'report' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Symbolic Links
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the symbolic links that will be created when the
|
||||||
|
| `storage:link` Artisan command is executed. The array keys should be
|
||||||
|
| the locations of the links and the values should be their targets.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
132
config/logging.php
Normal file
132
config/logging.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Monolog\Handler\NullHandler;
|
||||||
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option defines the default log channel that is utilized to write
|
||||||
|
| messages to your logs. The value provided here should match one of
|
||||||
|
| the channels present in the list of "channels" configured below.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('LOG_CHANNEL', 'stack'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Deprecations Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the log channel that should be used to log warnings
|
||||||
|
| regarding deprecated PHP and library features. This allows you to get
|
||||||
|
| your application ready for upcoming major versions of dependencies.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'deprecations' => [
|
||||||
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||||
|
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Log Channels
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the log channels for your application. Laravel
|
||||||
|
| utilizes the Monolog PHP logging library, which includes a variety
|
||||||
|
| of powerful log handlers and formatters that you're free to use.
|
||||||
|
|
|
||||||
|
| Available drivers: "single", "daily", "slack", "syslog",
|
||||||
|
| "errorlog", "monolog", "custom", "stack"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'channels' => [
|
||||||
|
|
||||||
|
'stack' => [
|
||||||
|
'driver' => 'stack',
|
||||||
|
'channels' => explode(',', env('LOG_STACK', 'single')),
|
||||||
|
'ignore_exceptions' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'single' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'daily' => [
|
||||||
|
'driver' => 'daily',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'days' => env('LOG_DAILY_DAYS', 14),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'driver' => 'slack',
|
||||||
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
|
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
|
||||||
|
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
|
||||||
|
'level' => env('LOG_LEVEL', 'critical'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'papertrail' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||||
|
'handler_with' => [
|
||||||
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
|
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'stderr' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => StreamHandler::class,
|
||||||
|
'handler_with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'syslog' => [
|
||||||
|
'driver' => 'syslog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'errorlog' => [
|
||||||
|
'driver' => 'errorlog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'handler' => NullHandler::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'emergency' => [
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
116
config/mail.php
Normal file
116
config/mail.php
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Mailer
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default mailer that is used to send all email
|
||||||
|
| messages unless another mailer is explicitly specified when sending
|
||||||
|
| the message. All additional mailers can be configured within the
|
||||||
|
| "mailers" array. Examples of each type of mailer are provided.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('MAIL_MAILER', 'log'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mailer Configurations
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure all of the mailers used by your application plus
|
||||||
|
| their respective settings. Several examples have been configured for
|
||||||
|
| you and you are free to add your own as your application requires.
|
||||||
|
|
|
||||||
|
| Laravel supports a variety of mail "transport" drivers that can be used
|
||||||
|
| when delivering an email. You may specify which one you're using for
|
||||||
|
| your mailers below. You may also add additional mailers if needed.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||||
|
| "postmark", "resend", "log", "array",
|
||||||
|
| "failover", "roundrobin"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailers' => [
|
||||||
|
|
||||||
|
'smtp' => [
|
||||||
|
'transport' => 'smtp',
|
||||||
|
'scheme' => env('MAIL_SCHEME'),
|
||||||
|
'url' => env('MAIL_URL'),
|
||||||
|
'host' => env('MAIL_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('MAIL_PORT', 2525),
|
||||||
|
'username' => env('MAIL_USERNAME'),
|
||||||
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
'timeout' => null,
|
||||||
|
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'transport' => 'ses',
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'transport' => 'postmark',
|
||||||
|
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'resend' => [
|
||||||
|
'transport' => 'resend',
|
||||||
|
],
|
||||||
|
|
||||||
|
'sendmail' => [
|
||||||
|
'transport' => 'sendmail',
|
||||||
|
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'transport' => 'log',
|
||||||
|
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'transport' => 'array',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'transport' => 'failover',
|
||||||
|
'mailers' => [
|
||||||
|
'smtp',
|
||||||
|
'log',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'roundrobin' => [
|
||||||
|
'transport' => 'roundrobin',
|
||||||
|
'mailers' => [
|
||||||
|
'ses',
|
||||||
|
'postmark',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global "From" Address
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may wish for all emails sent by your application to be sent from
|
||||||
|
| the same address. Here you may specify a name and address that is
|
||||||
|
| used globally for all emails that are sent by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'from' => [
|
||||||
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||||
|
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
112
config/queue.php
Normal file
112
config/queue.php
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Queue Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Laravel's queue supports a variety of backends via a single, unified
|
||||||
|
| API, giving you convenient access to each backend using identical
|
||||||
|
| syntax for each. The default queue connection is defined below.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('QUEUE_CONNECTION', 'database'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Queue Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the connection options for every queue backend
|
||||||
|
| used by your application. An example configuration is provided for
|
||||||
|
| each backend supported by Laravel. You're also free to add more.
|
||||||
|
|
|
||||||
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sync' => [
|
||||||
|
'driver' => 'sync',
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'connection' => env('DB_QUEUE_CONNECTION'),
|
||||||
|
'table' => env('DB_QUEUE_TABLE', 'jobs'),
|
||||||
|
'queue' => env('DB_QUEUE', 'default'),
|
||||||
|
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'beanstalkd' => [
|
||||||
|
'driver' => 'beanstalkd',
|
||||||
|
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
|
||||||
|
'queue' => env('BEANSTALKD_QUEUE', 'default'),
|
||||||
|
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
|
||||||
|
'block_for' => 0,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqs' => [
|
||||||
|
'driver' => 'sqs',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||||
|
'queue' => env('SQS_QUEUE', 'default'),
|
||||||
|
'suffix' => env('SQS_SUFFIX'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
|
||||||
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
|
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
|
||||||
|
'block_for' => null,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Job Batching
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following options configure the database and table that store job
|
||||||
|
| batching information. These options can be updated to any database
|
||||||
|
| connection and table which has been defined by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'batching' => [
|
||||||
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Failed Queue Jobs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These options configure the behavior of failed queue job logging so you
|
||||||
|
| can control how and where failed jobs are stored. Laravel ships with
|
||||||
|
| support for storing failed jobs in a simple file or in a database.
|
||||||
|
|
|
||||||
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => [
|
||||||
|
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||||
|
'database' => env('DB_CONNECTION', 'sqlite'),
|
||||||
|
'table' => 'failed_jobs',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
84
config/sanctum.php
Normal file
84
config/sanctum.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Sanctum\Sanctum;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Stateful Domains
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Requests from the following domains / hosts will receive stateful API
|
||||||
|
| authentication cookies. Typically, these should include your local
|
||||||
|
| and production domains which access your API via a frontend SPA.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||||
|
'%s%s',
|
||||||
|
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||||
|
Sanctum::currentApplicationUrlWithPort(),
|
||||||
|
// Sanctum::currentRequestHost(),
|
||||||
|
))),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This array contains the authentication guards that will be checked when
|
||||||
|
| Sanctum is trying to authenticate a request. If none of these guards
|
||||||
|
| are able to authenticate the request, Sanctum will use the bearer
|
||||||
|
| token that's present on an incoming request for authentication.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guard' => ['web'],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Expiration Minutes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value controls the number of minutes until an issued token will be
|
||||||
|
| considered expired. This will override any values set in the token's
|
||||||
|
| "expires_at" attribute, but first-party sessions are not affected.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'expiration' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Token Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Sanctum can prefix new tokens in order to take advantage of numerous
|
||||||
|
| security scanning initiatives maintained by open source platforms
|
||||||
|
| that notify developers if they commit tokens into repositories.
|
||||||
|
|
|
||||||
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Middleware
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When authenticating your first-party SPA with Sanctum you may need to
|
||||||
|
| customize some of the middleware Sanctum uses while processing the
|
||||||
|
| request. You may change the middleware listed below as required.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'middleware' => [
|
||||||
|
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
|
||||||
|
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
|
||||||
|
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
111
config/scramble.php
Normal file
111
config/scramble.php
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Dedoc\Scramble\Http\Middleware\RestrictedDocsAccess;
|
||||||
|
|
||||||
|
return [
|
||||||
|
/*
|
||||||
|
* Your API path. By default, all routes starting with this path will be added to the docs.
|
||||||
|
* If you need to change this behavior, you can add your custom routes resolver using `Scramble::routes()`.
|
||||||
|
*/
|
||||||
|
'api_path' => 'api',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Your API domain. By default, app domain is used. This is also a part of the default API routes
|
||||||
|
* matcher, so when implementing your own, make sure you use this config if needed.
|
||||||
|
*/
|
||||||
|
'api_domain' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The path where your OpenAPI specification will be exported.
|
||||||
|
*/
|
||||||
|
'export_path' => 'api.json',
|
||||||
|
|
||||||
|
'info' => [
|
||||||
|
/*
|
||||||
|
* API version.
|
||||||
|
*/
|
||||||
|
'version' => env('API_VERSION', '0.0.1'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Description rendered on the home page of the API documentation (`/docs/api`).
|
||||||
|
*/
|
||||||
|
'description' => 'Mimicing the SmartDok api made by Visma',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Customize Stoplight Elements UI
|
||||||
|
*/
|
||||||
|
'ui' => [
|
||||||
|
/*
|
||||||
|
* Define the title of the documentation's website. App name is used when this config is `null`.
|
||||||
|
*/
|
||||||
|
'title' => 'API Testplatform',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Define the theme of the documentation. Available options are `light` and `dark`.
|
||||||
|
*/
|
||||||
|
'theme' => 'light',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide the `Try It` feature. Enabled by default.
|
||||||
|
*/
|
||||||
|
'hide_try_it' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Hide the schemas in the Table of Contents. Enabled by default.
|
||||||
|
*/
|
||||||
|
'hide_schemas' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* URL to an image that displays as a small square logo next to the title, above the table of contents.
|
||||||
|
*/
|
||||||
|
'logo' => '/apple-touch-icon.png',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use to fetch the credential policy for the Try It feature. Options are: omit, include (default), and same-origin
|
||||||
|
*/
|
||||||
|
'try_it_credentials_policy' => 'include',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* There are three layouts for Elements:
|
||||||
|
* - sidebar - (Elements default) Three-column design with a sidebar that can be resized.
|
||||||
|
* - responsive - Like sidebar, except at small screen sizes it collapses the sidebar into a drawer that can be toggled open.
|
||||||
|
* - stacked - Everything in a single column, making integrations with existing websites that have their own sidebar or other columns already.
|
||||||
|
*/
|
||||||
|
'layout' => 'responsive',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The list of servers of the API. By default, when `null`, server URL will be created from
|
||||||
|
* `scramble.api_path` and `scramble.api_domain` config variables. When providing an array, you
|
||||||
|
* will need to specify the local server URL manually (if needed).
|
||||||
|
*
|
||||||
|
* Example of non-default config (final URLs are generated using Laravel `url` helper):
|
||||||
|
*
|
||||||
|
* ```php
|
||||||
|
* 'servers' => [
|
||||||
|
* 'Live' => 'api',
|
||||||
|
* 'Prod' => 'https://scramble.dedoc.co/api',
|
||||||
|
* ],
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
'servers' => null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines how Scramble stores the descriptions of enum cases.
|
||||||
|
* Available options:
|
||||||
|
* - 'description' – Case descriptions are stored as the enum schema's description using table formatting.
|
||||||
|
* - 'extension' – Case descriptions are stored in the `x-enumDescriptions` enum schema extension.
|
||||||
|
*
|
||||||
|
* @see https://redocly.com/docs-legacy/api-reference-docs/specification-extensions/x-enum-descriptions
|
||||||
|
* - false - Case descriptions are ignored.
|
||||||
|
*/
|
||||||
|
'enum_cases_description_strategy' => 'description',
|
||||||
|
|
||||||
|
'middleware' => [
|
||||||
|
'web',
|
||||||
|
RestrictedDocsAccess::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'extensions' => [],
|
||||||
|
];
|
38
config/services.php
Normal file
38
config/services.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Third Party Services
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is for storing the credentials for third party services such
|
||||||
|
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||||
|
| location for this type of information, allowing packages to have
|
||||||
|
| a conventional file to locate the various service credentials.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'token' => env('POSTMARK_TOKEN'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'resend' => [
|
||||||
|
'key' => env('RESEND_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'notifications' => [
|
||||||
|
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
|
||||||
|
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
217
config/session.php
Normal file
217
config/session.php
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Session Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines the default session driver that is utilized for
|
||||||
|
| incoming requests. Laravel supports a variety of storage options to
|
||||||
|
| persist session data. Database storage is a great default choice.
|
||||||
|
|
|
||||||
|
| Supported: "file", "cookie", "database", "apc",
|
||||||
|
| "memcached", "redis", "dynamodb", "array"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => env('SESSION_DRIVER', 'database'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Lifetime
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the number of minutes that you wish the session
|
||||||
|
| to be allowed to remain idle before it expires. If you want them
|
||||||
|
| to expire immediately when the browser is closed then you may
|
||||||
|
| indicate that via the expire_on_close configuration option.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lifetime' => (int) env('SESSION_LIFETIME', 120),
|
||||||
|
|
||||||
|
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Encryption
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option allows you to easily specify that all of your session data
|
||||||
|
| should be encrypted before it's stored. All encryption is performed
|
||||||
|
| automatically by Laravel and you may use the session like normal.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'encrypt' => env('SESSION_ENCRYPT', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session File Location
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing the "file" session driver, the session files are placed
|
||||||
|
| on disk. The default storage location is defined here; however, you
|
||||||
|
| are free to provide another location where they should be stored.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'files' => storage_path('framework/sessions'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Connection
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" or "redis" session drivers, you may specify a
|
||||||
|
| connection that should be used to manage these sessions. This should
|
||||||
|
| correspond to a connection in your database configuration options.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connection' => env('SESSION_CONNECTION'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" session driver, you may specify the table to
|
||||||
|
| be used to store sessions. Of course, a sensible default is defined
|
||||||
|
| for you; however, you're welcome to change this to another table.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'table' => env('SESSION_TABLE', 'sessions'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using one of the framework's cache driven session backends, you may
|
||||||
|
| define the cache store which should be used to store the session data
|
||||||
|
| between requests. This must match one of your defined cache stores.
|
||||||
|
|
|
||||||
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'store' => env('SESSION_STORE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Sweeping Lottery
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Some session drivers must manually sweep their storage location to get
|
||||||
|
| rid of old sessions from storage. Here are the chances that it will
|
||||||
|
| happen on a given request. By default, the odds are 2 out of 100.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lottery' => [2, 100],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may change the name of the session cookie that is created by
|
||||||
|
| the framework. Typically, you should not need to change this value
|
||||||
|
| since doing so does not grant a meaningful security improvement.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cookie' => env(
|
||||||
|
'SESSION_COOKIE',
|
||||||
|
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||||
|
),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The session cookie path determines the path for which the cookie will
|
||||||
|
| be regarded as available. Typically, this will be the root path of
|
||||||
|
| your application, but you're free to change this when necessary.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'path' => env('SESSION_PATH', '/'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Domain
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value determines the domain and subdomains the session cookie is
|
||||||
|
| available to. By default, the cookie will be available to the root
|
||||||
|
| domain and all subdomains. Typically, this shouldn't be changed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'domain' => env('SESSION_DOMAIN'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTPS Only Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By setting this option to true, session cookies will only be sent back
|
||||||
|
| to the server if the browser has a HTTPS connection. This will keep
|
||||||
|
| the cookie from being sent to you when it can't be done securely.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTP Access Only
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Setting this value to true will prevent JavaScript from accessing the
|
||||||
|
| value of the cookie and the cookie will only be accessible through
|
||||||
|
| the HTTP protocol. It's unlikely you should disable this option.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'http_only' => env('SESSION_HTTP_ONLY', true),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Same-Site Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines how your cookies behave when cross-site requests
|
||||||
|
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||||
|
| will set this value to "lax" to permit secure cross-site requests.
|
||||||
|
|
|
||||||
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
||||||
|
|
|
||||||
|
| Supported: "lax", "strict", "none", null
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'same_site' => env('SESSION_SAME_SITE', 'lax'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Partitioned Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Setting this value to true will tie the cookie to the top-level site for
|
||||||
|
| a cross-site context. Partitioned cookies are accepted by the browser
|
||||||
|
| when flagged "secure" and the Same-Site attribute is set to "none".
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
|
||||||
|
|
||||||
|
];
|
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.sqlite*
|
44
database/factories/UserFactory.php
Normal file
44
database/factories/UserFactory.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||||
|
*/
|
||||||
|
class UserFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The current password being used by the factory.
|
||||||
|
*/
|
||||||
|
protected static ?string $password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => fake()->name(),
|
||||||
|
'email' => fake()->unique()->safeEmail(),
|
||||||
|
'email_verified_at' => now(),
|
||||||
|
'password' => static::$password ??= Hash::make('password'),
|
||||||
|
'remember_token' => Str::random(10),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate that the model's email address should be unverified.
|
||||||
|
*/
|
||||||
|
public function unverified(): static
|
||||||
|
{
|
||||||
|
return $this->state(fn (array $attributes) => [
|
||||||
|
'email_verified_at' => null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
49
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
49
database/migrations/0001_01_01_000000_create_users_table.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('users', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('email')->unique();
|
||||||
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
|
$table->string('password');
|
||||||
|
$table->rememberToken();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||||
|
$table->string('email')->primary();
|
||||||
|
$table->string('token');
|
||||||
|
$table->timestamp('created_at')->nullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('sessions', function (Blueprint $table) {
|
||||||
|
$table->string('id')->primary();
|
||||||
|
$table->foreignId('user_id')->nullable()->index();
|
||||||
|
$table->string('ip_address', 45)->nullable();
|
||||||
|
$table->text('user_agent')->nullable();
|
||||||
|
$table->longText('payload');
|
||||||
|
$table->integer('last_activity')->index();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('users');
|
||||||
|
Schema::dropIfExists('password_reset_tokens');
|
||||||
|
Schema::dropIfExists('sessions');
|
||||||
|
}
|
||||||
|
};
|
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
35
database/migrations/0001_01_01_000001_create_cache_table.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('cache', function (Blueprint $table) {
|
||||||
|
$table->string('key')->primary();
|
||||||
|
$table->mediumText('value');
|
||||||
|
$table->integer('expiration');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('cache_locks', function (Blueprint $table) {
|
||||||
|
$table->string('key')->primary();
|
||||||
|
$table->string('owner');
|
||||||
|
$table->integer('expiration');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('cache');
|
||||||
|
Schema::dropIfExists('cache_locks');
|
||||||
|
}
|
||||||
|
};
|
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
57
database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('jobs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('queue')->index();
|
||||||
|
$table->longText('payload');
|
||||||
|
$table->unsignedTinyInteger('attempts');
|
||||||
|
$table->unsignedInteger('reserved_at')->nullable();
|
||||||
|
$table->unsignedInteger('available_at');
|
||||||
|
$table->unsignedInteger('created_at');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('job_batches', function (Blueprint $table) {
|
||||||
|
$table->string('id')->primary();
|
||||||
|
$table->string('name');
|
||||||
|
$table->integer('total_jobs');
|
||||||
|
$table->integer('pending_jobs');
|
||||||
|
$table->integer('failed_jobs');
|
||||||
|
$table->longText('failed_job_ids');
|
||||||
|
$table->mediumText('options')->nullable();
|
||||||
|
$table->integer('cancelled_at')->nullable();
|
||||||
|
$table->integer('created_at');
|
||||||
|
$table->integer('finished_at')->nullable();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('uuid')->unique();
|
||||||
|
$table->text('connection');
|
||||||
|
$table->text('queue');
|
||||||
|
$table->longText('payload');
|
||||||
|
$table->longText('exception');
|
||||||
|
$table->timestamp('failed_at')->useCurrent();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('jobs');
|
||||||
|
Schema::dropIfExists('job_batches');
|
||||||
|
Schema::dropIfExists('failed_jobs');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->morphs('tokenable');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('token', 64)->unique();
|
||||||
|
$table->text('abilities')->nullable();
|
||||||
|
$table->timestamp('last_used_at')->nullable();
|
||||||
|
$table->timestamp('expires_at')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('personal_access_tokens');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateSmartdokProfilesTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::create('smartdok_profiles', function (Blueprint $table) {
|
||||||
|
$table->uuid('id')->primary();
|
||||||
|
$table->string('username');
|
||||||
|
$table->string('name');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::dropIfExists('smartdok_profiles');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateDepartmentsTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::create('departments', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::dropIfExists('departments');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateProjectsTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::create('projects', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('project_name');
|
||||||
|
$table->string('project_number');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::dropIfExists('projects');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateProjectSmartdokProfileTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::create('project_smartdok_profile', function (Blueprint $table) {
|
||||||
|
$table->unsignedBigInteger('project_id');
|
||||||
|
$table->uuid('smartdok_profile_id');
|
||||||
|
|
||||||
|
$table->foreign('project_id')
|
||||||
|
->references('id')->on('projects')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->foreign('smartdok_profile_id')
|
||||||
|
->references('id')->on('smartdok_profiles')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->primary(['project_id', 'smartdok_profile_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::dropIfExists('project_smartdok_profile');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateDepartmentProjectTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::create('department_project', function (Blueprint $table) {
|
||||||
|
$table->unsignedBigInteger('department_id');
|
||||||
|
$table->unsignedBigInteger('project_id');
|
||||||
|
|
||||||
|
$table->foreign('department_id')
|
||||||
|
->references('id')->on('departments')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->foreign('project_id')
|
||||||
|
->references('id')->on('projects')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->primary(['department_id', 'project_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::dropIfExists('department_project');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateWorkHoursTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::create('work_hours', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->uuid('user_id');
|
||||||
|
$table->decimal('ordinary_hours', 4, 1);
|
||||||
|
$table->date('work_date');
|
||||||
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->foreign('user_id')
|
||||||
|
->references('id')->on('smartdok_profiles')
|
||||||
|
->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::dropIfExists('work_hours');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateProjectWorkhourTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::create('project_workhour', function (Blueprint $table) {
|
||||||
|
$table->string('workhour_id');
|
||||||
|
$table->unsignedBigInteger('project_id');
|
||||||
|
|
||||||
|
$table->foreign('workhour_id')
|
||||||
|
->references('id')->on('work_hours')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->foreign('project_id')
|
||||||
|
->references('id')->on('projects')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->primary(['workhour_id', 'project_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::dropIfExists('project_workhour');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddCommentToWorkHoursTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::table('work_hours', function (Blueprint $table) {
|
||||||
|
$table->text('comment')
|
||||||
|
->after('work_date')
|
||||||
|
->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::table('work_hours', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('comment');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddProjectIdToWorkHoursTable extends Migration
|
||||||
|
{
|
||||||
|
public function up() {
|
||||||
|
Schema::table('work_hours', function (Blueprint $table) {
|
||||||
|
// assuming projects.id is bigIncrements
|
||||||
|
$table->unsignedBigInteger('project_id')
|
||||||
|
->after('user_id')
|
||||||
|
->nullable(false);
|
||||||
|
|
||||||
|
$table->foreign('project_id')
|
||||||
|
->references('id')
|
||||||
|
->on('projects')
|
||||||
|
->onDelete('cascade');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::table('work_hours', function (Blueprint $table) {
|
||||||
|
$table->dropForeign(['project_id']);
|
||||||
|
$table->dropColumn('project_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void {
|
||||||
|
Schema::table('project_workhour', function (Blueprint $table) {
|
||||||
|
Schema::dropIfExists('project_workhour');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void {
|
||||||
|
Schema::table('project_workhour', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void {
|
||||||
|
Schema::create('apikeys', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('category')->unique();
|
||||||
|
$table->string('key');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void {
|
||||||
|
Schema::dropIfExists('apikeys');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void {
|
||||||
|
Schema::create('apiadmins', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('user_id');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void {
|
||||||
|
Schema::dropIfExists('apiadmins');
|
||||||
|
}
|
||||||
|
};
|
23
database/seeders/DatabaseSeeder.php
Normal file
23
database/seeders/DatabaseSeeder.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class DatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Seed the application's database.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
// User::factory(10)->create();
|
||||||
|
|
||||||
|
User::factory()->create([
|
||||||
|
'name' => 'Test User',
|
||||||
|
'email' => 'test@example.com',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
19
eslint.config.js
Normal file
19
eslint.config.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import prettier from 'eslint-config-prettier';
|
||||||
|
import vue from 'eslint-plugin-vue';
|
||||||
|
|
||||||
|
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
|
||||||
|
|
||||||
|
export default defineConfigWithVueTs(
|
||||||
|
vue.configs['flat/essential'],
|
||||||
|
vueTsConfigs.recommended,
|
||||||
|
{
|
||||||
|
ignores: ['vendor', 'node_modules', 'public', 'bootstrap/ssr', 'tailwind.config.js', 'resources/js/components/ui/*'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
prettier,
|
||||||
|
);
|
20
lang/en/auth.php
Normal file
20
lang/en/auth.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are used during authentication for various
|
||||||
|
| messages that we need to display to the user. You are free to modify
|
||||||
|
| these language lines according to your application's requirements.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => 'These credentials do not match our records.',
|
||||||
|
'password' => 'The provided password is incorrect.',
|
||||||
|
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||||
|
|
||||||
|
];
|
19
lang/en/pagination.php
Normal file
19
lang/en/pagination.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Pagination Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are used by the paginator library to build
|
||||||
|
| the simple pagination links. You are free to change them to anything
|
||||||
|
| you want to customize your views to better match your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'previous' => '« Previous',
|
||||||
|
'next' => 'Next »',
|
||||||
|
|
||||||
|
];
|
22
lang/en/passwords.php
Normal file
22
lang/en/passwords.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are the default lines which match reasons
|
||||||
|
| that are given by the password broker for a password update attempt
|
||||||
|
| outcome such as failure due to an invalid password / reset token.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'reset' => 'Your password has been reset.',
|
||||||
|
'sent' => 'We have emailed your password reset link.',
|
||||||
|
'throttled' => 'Please wait before retrying.',
|
||||||
|
'token' => 'This password reset token is invalid.',
|
||||||
|
'user' => "We can't find a user with that email address.",
|
||||||
|
|
||||||
|
];
|
197
lang/en/validation.php
Normal file
197
lang/en/validation.php
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Validation Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines contain the default error messages used by
|
||||||
|
| the validator class. Some of these rules have multiple versions such
|
||||||
|
| as the size rules. Feel free to tweak each of these messages here.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'accepted' => 'The :attribute field must be accepted.',
|
||||||
|
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
|
||||||
|
'active_url' => 'The :attribute field must be a valid URL.',
|
||||||
|
'after' => 'The :attribute field must be a date after :date.',
|
||||||
|
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
|
||||||
|
'alpha' => 'The :attribute field must only contain letters.',
|
||||||
|
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
|
||||||
|
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
|
||||||
|
'any_of' => 'The :attribute field is invalid.',
|
||||||
|
'array' => 'The :attribute field must be an array.',
|
||||||
|
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
|
||||||
|
'before' => 'The :attribute field must be a date before :date.',
|
||||||
|
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
|
||||||
|
'between' => [
|
||||||
|
'array' => 'The :attribute field must have between :min and :max items.',
|
||||||
|
'file' => 'The :attribute field must be between :min and :max kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be between :min and :max.',
|
||||||
|
'string' => 'The :attribute field must be between :min and :max characters.',
|
||||||
|
],
|
||||||
|
'boolean' => 'The :attribute field must be true or false.',
|
||||||
|
'can' => 'The :attribute field contains an unauthorized value.',
|
||||||
|
'confirmed' => 'The :attribute field confirmation does not match.',
|
||||||
|
'contains' => 'The :attribute field is missing a required value.',
|
||||||
|
'current_password' => 'The password is incorrect.',
|
||||||
|
'date' => 'The :attribute field must be a valid date.',
|
||||||
|
'date_equals' => 'The :attribute field must be a date equal to :date.',
|
||||||
|
'date_format' => 'The :attribute field must match the format :format.',
|
||||||
|
'decimal' => 'The :attribute field must have :decimal decimal places.',
|
||||||
|
'declined' => 'The :attribute field must be declined.',
|
||||||
|
'declined_if' => 'The :attribute field must be declined when :other is :value.',
|
||||||
|
'different' => 'The :attribute field and :other must be different.',
|
||||||
|
'digits' => 'The :attribute field must be :digits digits.',
|
||||||
|
'digits_between' => 'The :attribute field must be between :min and :max digits.',
|
||||||
|
'dimensions' => 'The :attribute field has invalid image dimensions.',
|
||||||
|
'distinct' => 'The :attribute field has a duplicate value.',
|
||||||
|
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
|
||||||
|
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
|
||||||
|
'email' => 'The :attribute field must be a valid email address.',
|
||||||
|
'ends_with' => 'The :attribute field must end with one of the following: :values.',
|
||||||
|
'enum' => 'The selected :attribute is invalid.',
|
||||||
|
'exists' => 'The selected :attribute is invalid.',
|
||||||
|
'extensions' => 'The :attribute field must have one of the following extensions: :values.',
|
||||||
|
'file' => 'The :attribute field must be a file.',
|
||||||
|
'filled' => 'The :attribute field must have a value.',
|
||||||
|
'gt' => [
|
||||||
|
'array' => 'The :attribute field must have more than :value items.',
|
||||||
|
'file' => 'The :attribute field must be greater than :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be greater than :value.',
|
||||||
|
'string' => 'The :attribute field must be greater than :value characters.',
|
||||||
|
],
|
||||||
|
'gte' => [
|
||||||
|
'array' => 'The :attribute field must have :value items or more.',
|
||||||
|
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be greater than or equal to :value.',
|
||||||
|
'string' => 'The :attribute field must be greater than or equal to :value characters.',
|
||||||
|
],
|
||||||
|
'hex_color' => 'The :attribute field must be a valid hexadecimal color.',
|
||||||
|
'image' => 'The :attribute field must be an image.',
|
||||||
|
'in' => 'The selected :attribute is invalid.',
|
||||||
|
'in_array' => 'The :attribute field must exist in :other.',
|
||||||
|
'integer' => 'The :attribute field must be an integer.',
|
||||||
|
'ip' => 'The :attribute field must be a valid IP address.',
|
||||||
|
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
|
||||||
|
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
|
||||||
|
'json' => 'The :attribute field must be a valid JSON string.',
|
||||||
|
'list' => 'The :attribute field must be a list.',
|
||||||
|
'lowercase' => 'The :attribute field must be lowercase.',
|
||||||
|
'lt' => [
|
||||||
|
'array' => 'The :attribute field must have less than :value items.',
|
||||||
|
'file' => 'The :attribute field must be less than :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be less than :value.',
|
||||||
|
'string' => 'The :attribute field must be less than :value characters.',
|
||||||
|
],
|
||||||
|
'lte' => [
|
||||||
|
'array' => 'The :attribute field must not have more than :value items.',
|
||||||
|
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be less than or equal to :value.',
|
||||||
|
'string' => 'The :attribute field must be less than or equal to :value characters.',
|
||||||
|
],
|
||||||
|
'mac_address' => 'The :attribute field must be a valid MAC address.',
|
||||||
|
'max' => [
|
||||||
|
'array' => 'The :attribute field must not have more than :max items.',
|
||||||
|
'file' => 'The :attribute field must not be greater than :max kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must not be greater than :max.',
|
||||||
|
'string' => 'The :attribute field must not be greater than :max characters.',
|
||||||
|
],
|
||||||
|
'max_digits' => 'The :attribute field must not have more than :max digits.',
|
||||||
|
'mimes' => 'The :attribute field must be a file of type: :values.',
|
||||||
|
'mimetypes' => 'The :attribute field must be a file of type: :values.',
|
||||||
|
'min' => [
|
||||||
|
'array' => 'The :attribute field must have at least :min items.',
|
||||||
|
'file' => 'The :attribute field must be at least :min kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be at least :min.',
|
||||||
|
'string' => 'The :attribute field must be at least :min characters.',
|
||||||
|
],
|
||||||
|
'min_digits' => 'The :attribute field must have at least :min digits.',
|
||||||
|
'missing' => 'The :attribute field must be missing.',
|
||||||
|
'missing_if' => 'The :attribute field must be missing when :other is :value.',
|
||||||
|
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
|
||||||
|
'missing_with' => 'The :attribute field must be missing when :values is present.',
|
||||||
|
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
|
||||||
|
'multiple_of' => 'The :attribute field must be a multiple of :value.',
|
||||||
|
'not_in' => 'The selected :attribute is invalid.',
|
||||||
|
'not_regex' => 'The :attribute field format is invalid.',
|
||||||
|
'numeric' => 'The :attribute field must be a number.',
|
||||||
|
'password' => [
|
||||||
|
'letters' => 'The :attribute field must contain at least one letter.',
|
||||||
|
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
|
||||||
|
'numbers' => 'The :attribute field must contain at least one number.',
|
||||||
|
'symbols' => 'The :attribute field must contain at least one symbol.',
|
||||||
|
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
|
||||||
|
],
|
||||||
|
'present' => 'The :attribute field must be present.',
|
||||||
|
'present_if' => 'The :attribute field must be present when :other is :value.',
|
||||||
|
'present_unless' => 'The :attribute field must be present unless :other is :value.',
|
||||||
|
'present_with' => 'The :attribute field must be present when :values is present.',
|
||||||
|
'present_with_all' => 'The :attribute field must be present when :values are present.',
|
||||||
|
'prohibited' => 'The :attribute field is prohibited.',
|
||||||
|
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
|
||||||
|
'prohibited_if_accepted' => 'The :attribute field is prohibited when :other is accepted.',
|
||||||
|
'prohibited_if_declined' => 'The :attribute field is prohibited when :other is declined.',
|
||||||
|
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
|
||||||
|
'prohibits' => 'The :attribute field prohibits :other from being present.',
|
||||||
|
'regex' => 'The :attribute field format is invalid.',
|
||||||
|
'required' => 'The :attribute field is required.',
|
||||||
|
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
|
||||||
|
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||||
|
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
|
||||||
|
'required_if_declined' => 'The :attribute field is required when :other is declined.',
|
||||||
|
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||||
|
'required_with' => 'The :attribute field is required when :values is present.',
|
||||||
|
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||||
|
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||||
|
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||||
|
'same' => 'The :attribute field must match :other.',
|
||||||
|
'size' => [
|
||||||
|
'array' => 'The :attribute field must contain :size items.',
|
||||||
|
'file' => 'The :attribute field must be :size kilobytes.',
|
||||||
|
'numeric' => 'The :attribute field must be :size.',
|
||||||
|
'string' => 'The :attribute field must be :size characters.',
|
||||||
|
],
|
||||||
|
'starts_with' => 'The :attribute field must start with one of the following: :values.',
|
||||||
|
'string' => 'The :attribute field must be a string.',
|
||||||
|
'timezone' => 'The :attribute field must be a valid timezone.',
|
||||||
|
'unique' => 'The :attribute has already been taken.',
|
||||||
|
'uploaded' => 'The :attribute failed to upload.',
|
||||||
|
'uppercase' => 'The :attribute field must be uppercase.',
|
||||||
|
'url' => 'The :attribute field must be a valid URL.',
|
||||||
|
'ulid' => 'The :attribute field must be a valid ULID.',
|
||||||
|
'uuid' => 'The :attribute field must be a valid UUID.',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Custom Validation Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify custom validation messages for attributes using the
|
||||||
|
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||||
|
| specify a specific custom language line for a given attribute rule.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'custom' => [
|
||||||
|
'attribute-name' => [
|
||||||
|
'rule-name' => 'custom-message',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Custom Validation Attributes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are used to swap our attribute placeholder
|
||||||
|
| with something more reader friendly such as "E-Mail Address" instead
|
||||||
|
| of "email". This simply helps us make our message more expressive.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'attributes' => [],
|
||||||
|
|
||||||
|
];
|
20
lang/no/auth.php
Normal file
20
lang/no/auth.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| De følgende tekstene brukes under autentisering for ulike
|
||||||
|
| meldinger som vises til brukeren. Du står fritt til å endre
|
||||||
|
| disse tekstene etter behov i din applikasjon.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => 'Disse påloggingsopplysningene samsvarer ikke med våre registrerte opplysninger.',
|
||||||
|
'password' => 'Det oppgitte passordet er feil.',
|
||||||
|
'throttle' => 'For mange innloggingsforsøk. Vennligst prøv igjen om :seconds sekunder.',
|
||||||
|
|
||||||
|
];
|
19
lang/no/pagination.php
Normal file
19
lang/no/pagination.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Pagination Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| De følgende tekstene brukes av pagineringsbiblioteket for å lage
|
||||||
|
| enkle pagineringslenker. Du står fritt til å endre dem for å tilpasse
|
||||||
|
| visningene dine slik at de bedre passer applikasjonen din.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'previous' => '« Forrige',
|
||||||
|
'next' => 'Neste »',
|
||||||
|
|
||||||
|
];
|
22
lang/no/passwords.php
Normal file
22
lang/no/passwords.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| De følgende tekstene er standardmeldinger som samsvarer med årsaker
|
||||||
|
| gitt av passordmegleren ved forsøk på å tilbakestille passord,
|
||||||
|
| for eksempel ved ugyldig passord eller tilbakestillingskode.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'reset' => 'Passordet ditt har blitt tilbakestilt.',
|
||||||
|
'sent' => 'Vi har sendt deg en e-post med lenke for tilbakestilling av passord.',
|
||||||
|
'throttled' => 'Vennligst vent før du prøver igjen.',
|
||||||
|
'token' => 'Denne tilbakestillingskoden er ugyldig.',
|
||||||
|
'user' => 'Vi finner ingen bruker med den e-postadressen.',
|
||||||
|
|
||||||
|
];
|
175
lang/no/validation.php
Normal file
175
lang/no/validation.php
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Valideringsmeldinger
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Følgende linjer inneholder standard feilmeldinger brukt av validator-klassen.
|
||||||
|
| Noen av reglene har flere versjoner, for eksempel størrelsesregler.
|
||||||
|
| Du kan endre disse meldingene etter behov.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'accepted' => ':attribute må aksepteres.',
|
||||||
|
'accepted_if' => ':attribute må aksepteres når :other er :value.',
|
||||||
|
'active_url' => ':attribute må være en gyldig URL.',
|
||||||
|
'after' => ':attribute må være en dato etter :date.',
|
||||||
|
'after_or_equal' => ':attribute må være en dato etter eller lik :date.',
|
||||||
|
'alpha' => ':attribute kan kun inneholde bokstaver.',
|
||||||
|
'alpha_dash' => ':attribute kan kun inneholde bokstaver, tall, bindestreker og understreker.',
|
||||||
|
'alpha_num' => ':attribute kan kun inneholde bokstaver og tall.',
|
||||||
|
'any_of' => ':attribute er ugyldig.',
|
||||||
|
'array' => ':attribute må være et array.',
|
||||||
|
'ascii' => ':attribute kan kun inneholde ASCII-tegn.',
|
||||||
|
'before' => ':attribute må være en dato før :date.',
|
||||||
|
'before_or_equal' => ':attribute må være en dato før eller lik :date.',
|
||||||
|
'between' => [
|
||||||
|
'array' => ':attribute må ha mellom :min og :max elementer.',
|
||||||
|
'file' => ':attribute må være mellom :min og :max kilobyte.',
|
||||||
|
'numeric' => ':attribute må være mellom :min og :max.',
|
||||||
|
'string' => ':attribute må være mellom :min og :max tegn.',
|
||||||
|
],
|
||||||
|
'boolean' => ':attribute må være sann eller usann.',
|
||||||
|
'can' => ':attribute inneholder en ugyldig verdi.',
|
||||||
|
'confirmed' => 'Bekreftelsen for :attribute stemmer ikke.',
|
||||||
|
'contains' => ':attribute mangler en påkrevd verdi.',
|
||||||
|
'current_password' => 'Passordet er feil.',
|
||||||
|
'date' => ':attribute må være en gyldig dato.',
|
||||||
|
'date_equals' => ':attribute må være en dato som er lik :date.',
|
||||||
|
'date_format' => ':attribute må ha formatet :format.',
|
||||||
|
'decimal' => ':attribute må ha :decimal desimaler.',
|
||||||
|
'declined' => ':attribute må avvises.',
|
||||||
|
'declined_if' => ':attribute må avvises når :other er :value.',
|
||||||
|
'different' => ':attribute og :other må være forskjellige.',
|
||||||
|
'digits' => ':attribute må være :digits sifre.',
|
||||||
|
'digits_between' => ':attribute må være mellom :min og :max sifre.',
|
||||||
|
'dimensions' => ':attribute har ugyldige bildedimensjoner.',
|
||||||
|
'distinct' => ':attribute inneholder en duplisert verdi.',
|
||||||
|
'doesnt_end_with' => ':attribute må ikke slutte med en av følgende: :values.',
|
||||||
|
'doesnt_start_with' => ':attribute må ikke starte med en av følgende: :values.',
|
||||||
|
'email' => ':attribute må være en gyldig e-postadresse.',
|
||||||
|
'ends_with' => ':attribute må slutte med en av følgende: :values.',
|
||||||
|
'enum' => 'Valgt :attribute er ugyldig.',
|
||||||
|
'exists' => 'Valgt :attribute er ugyldig.',
|
||||||
|
'extensions' => ':attribute må ha en av følgende filendelser: :values.',
|
||||||
|
'file' => ':attribute må være en fil.',
|
||||||
|
'filled' => ':attribute må ha en verdi.',
|
||||||
|
'gt' => [
|
||||||
|
'array' => ':attribute må ha mer enn :value elementer.',
|
||||||
|
'file' => ':attribute må være større enn :value kilobyte.',
|
||||||
|
'numeric' => ':attribute må være større enn :value.',
|
||||||
|
'string' => ':attribute må være lengre enn :value tegn.',
|
||||||
|
],
|
||||||
|
'gte' => [
|
||||||
|
'array' => ':attribute må ha :value elementer eller flere.',
|
||||||
|
'file' => ':attribute må være større enn eller lik :value kilobyte.',
|
||||||
|
'numeric' => ':attribute må være større enn eller lik :value.',
|
||||||
|
'string' => ':attribute må være lengre enn eller lik :value tegn.',
|
||||||
|
],
|
||||||
|
'hex_color' => ':attribute må være en gyldig heksadesimal farge.',
|
||||||
|
'image' => ':attribute må være et bilde.',
|
||||||
|
'in' => 'Valgt :attribute er ugyldig.',
|
||||||
|
'in_array' => ':attribute finnes ikke i :other.',
|
||||||
|
'integer' => ':attribute må være et heltall.',
|
||||||
|
'ip' => ':attribute må være en gyldig IP-adresse.',
|
||||||
|
'ipv4' => ':attribute må være en gyldig IPv4-adresse.',
|
||||||
|
'ipv6' => ':attribute må være en gyldig IPv6-adresse.',
|
||||||
|
'json' => ':attribute må være en gyldig JSON-streng.',
|
||||||
|
'list' => ':attribute må være en liste.',
|
||||||
|
'lowercase' => ':attribute må være små bokstaver.',
|
||||||
|
'lt' => [
|
||||||
|
'array' => ':attribute må ha færre enn :value elementer.',
|
||||||
|
'file' => ':attribute må være mindre enn :value kilobyte.',
|
||||||
|
'numeric' => ':attribute må være mindre enn :value.',
|
||||||
|
'string' => ':attribute må være kortere enn :value tegn.',
|
||||||
|
],
|
||||||
|
'lte' => [
|
||||||
|
'array' => ':attribute må ikke ha flere enn :value elementer.',
|
||||||
|
'file' => ':attribute må være mindre enn eller lik :value kilobyte.',
|
||||||
|
'numeric' => ':attribute må være mindre enn eller lik :value.',
|
||||||
|
'string' => ':attribute må være kortere enn eller lik :value tegn.',
|
||||||
|
],
|
||||||
|
'mac_address' => ':attribute må være en gyldig MAC-adresse.',
|
||||||
|
'max' => [
|
||||||
|
'array' => ':attribute må ikke ha mer enn :max elementer.',
|
||||||
|
'file' => ':attribute må ikke være større enn :max kilobyte.',
|
||||||
|
'numeric' => ':attribute må ikke være større enn :max.',
|
||||||
|
'string' => ':attribute må ikke være lengre enn :max tegn.',
|
||||||
|
],
|
||||||
|
'max_digits' => ':attribute må ikke ha mer enn :max sifre.',
|
||||||
|
'mimes' => ':attribute må være en fil av typen: :values.',
|
||||||
|
'mimetypes' => ':attribute må være en fil av typen: :values.',
|
||||||
|
'min' => [
|
||||||
|
'array' => ':attribute må ha minst :min elementer.',
|
||||||
|
'file' => ':attribute må være minst :min kilobyte.',
|
||||||
|
'numeric' => ':attribute må være minst :min.',
|
||||||
|
'string' => ':attribute må være minst :min tegn.',
|
||||||
|
],
|
||||||
|
'min_digits' => ':attribute må ha minst :min sifre.',
|
||||||
|
'missing' => ':attribute må mangle.',
|
||||||
|
'missing_if' => ':attribute må mangle når :other er :value.',
|
||||||
|
'missing_unless' => ':attribute må mangle med mindre :other er :value.',
|
||||||
|
'missing_with' => ':attribute må mangle når :values er til stede.',
|
||||||
|
'missing_with_all' => ':attribute må mangle når :values er til stede.',
|
||||||
|
'multiple_of' => ':attribute må være et multiplum av :value.',
|
||||||
|
'not_in' => 'Valgt :attribute er ugyldig.',
|
||||||
|
'not_regex' => ':attribute har ugyldig format.',
|
||||||
|
'numeric' => ':attribute må være et tall.',
|
||||||
|
'password' => [
|
||||||
|
'letters' => ':attribute må inneholde minst én bokstav.',
|
||||||
|
'mixed' => ':attribute må inneholde minst én stor og én liten bokstav.',
|
||||||
|
'numbers' => ':attribute må inneholde minst ett tall.',
|
||||||
|
'symbols' => ':attribute må inneholde minst ett symbol.',
|
||||||
|
'uncompromised' => 'Det angitte :attribute er funnet i et datalekkasje. Velg et annet.',
|
||||||
|
],
|
||||||
|
'present' => ':attribute må være til stede.',
|
||||||
|
'present_if' => ':attribute må være til stede når :other er :value.',
|
||||||
|
'present_unless' => ':attribute må være til stede med mindre :other er :value.',
|
||||||
|
'present_with' => ':attribute må være til stede når :values er til stede.',
|
||||||
|
'present_with_all' => ':attribute må være til stede når :values er til stede.',
|
||||||
|
'prohibited' => ':attribute er forbudt.',
|
||||||
|
'prohibited_if' => ':attribute er forbudt når :other er :value.',
|
||||||
|
'prohibited_if_accepted' => ':attribute er forbudt når :other er akseptert.',
|
||||||
|
'prohibited_if_declined' => ':attribute er forbudt når :other er avvist.',
|
||||||
|
'prohibited_unless' => ':attribute er forbudt med mindre :other er i :values.',
|
||||||
|
'prohibits' => ':attribute forhindrer at :other er til stede.',
|
||||||
|
'regex' => ':attribute har ugyldig format.',
|
||||||
|
'required' => ':attribute er påkrevd.',
|
||||||
|
'required_array_keys' => ':attribute må inneholde oppføringer for: :values.',
|
||||||
|
'required_if' => ':attribute er påkrevd når :other er :value.',
|
||||||
|
'required_if_accepted' => ':attribute er påkrevd når :other er akseptert.',
|
||||||
|
'required_if_declined' => ':attribute er påkrevd når :other er avvist.',
|
||||||
|
'required_unless' => ':attribute er påkrevd med mindre :other er i :values.',
|
||||||
|
'required_with' => ':attribute er påkrevd når :values er til stede.',
|
||||||
|
'required_with_all' => ':attribute er påkrevd når :values er til stede.',
|
||||||
|
'required_without' => ':attribute er påkrevd når :values ikke er til stede.',
|
||||||
|
'required_without_all' => ':attribute er påkrevd når ingen av :values er til stede.',
|
||||||
|
'same' => ':attribute og :other må være like.',
|
||||||
|
'size' => [
|
||||||
|
'array' => ':attribute må inneholde :size elementer.',
|
||||||
|
'file' => ':attribute må være :size kilobyte.',
|
||||||
|
'numeric' => ':attribute må være :size.',
|
||||||
|
'string' => ':attribute må være :size tegn.',
|
||||||
|
],
|
||||||
|
'starts_with' => ':attribute må starte med en av følgende: :values.',
|
||||||
|
'string' => ':attribute må være en streng.',
|
||||||
|
'timezone' => ':attribute må være en gyldig tidssone.',
|
||||||
|
'unique' => ':attribute er allerede i bruk.',
|
||||||
|
'uploaded' => 'Opplasting av :attribute feilet.',
|
||||||
|
'uppercase' => ':attribute må være store bokstaver.',
|
||||||
|
'url' => ':attribute må være en gyldig URL.',
|
||||||
|
'ulid' => ':attribute må være en gyldig ULID.',
|
||||||
|
'uuid' => ':attribute må være en gyldig UUID.',
|
||||||
|
|
||||||
|
'custom' => [
|
||||||
|
'attribute-name' => [
|
||||||
|
'rule-name' => 'tilpasset-melding',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'attributes' => [],
|
||||||
|
|
||||||
|
];
|
4798
package-lock.json
generated
Normal file
4798
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
50
package.json
Normal file
50
package.json
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "vite build",
|
||||||
|
"build:ssr": "vite build && vite build --ssr",
|
||||||
|
"dev": "vite",
|
||||||
|
"format": "prettier --write resources/",
|
||||||
|
"format:check": "prettier --check resources/",
|
||||||
|
"lint": "eslint . --fix"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.19.0",
|
||||||
|
"@types/node": "^22.13.5",
|
||||||
|
"@vue/eslint-config-typescript": "^14.3.0",
|
||||||
|
"eslint": "^9.17.0",
|
||||||
|
"eslint-config-prettier": "^10.0.1",
|
||||||
|
"eslint-plugin-vue": "^9.32.0",
|
||||||
|
"prettier": "^3.4.2",
|
||||||
|
"prettier-plugin-organize-imports": "^4.1.0",
|
||||||
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
"typescript-eslint": "^8.23.0",
|
||||||
|
"vue-tsc": "^2.2.4"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@inertiajs/vue3": "^2.0.0",
|
||||||
|
"@tailwindcss/vite": "^4.1.1",
|
||||||
|
"@tanstack/vue-table": "^8.21.3",
|
||||||
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
|
"@vueuse/core": "^12.8.2",
|
||||||
|
"class-variance-authority": "^0.7.1",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"concurrently": "^9.0.1",
|
||||||
|
"laravel-vite-plugin": "^1.0",
|
||||||
|
"lucide-vue-next": "^0.468.0",
|
||||||
|
"reka-ui": "^2.2.1",
|
||||||
|
"tailwind-merge": "^3.2.0",
|
||||||
|
"tailwindcss": "^4.1.1",
|
||||||
|
"tw-animate-css": "^1.2.5",
|
||||||
|
"typescript": "^5.2.2",
|
||||||
|
"vite": "^6.2.0",
|
||||||
|
"vue": "^3.5.13",
|
||||||
|
"ziggy-js": "^2.4.2"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@rollup/rollup-linux-x64-gnu": "4.9.5",
|
||||||
|
"@tailwindcss/oxide-linux-x64-gnu": "^4.0.1",
|
||||||
|
"lightningcss-linux-x64-gnu": "^1.29.1"
|
||||||
|
}
|
||||||
|
}
|
33
phpunit.xml
Normal file
33
phpunit.xml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
|
bootstrap="vendor/autoload.php"
|
||||||
|
colors="true"
|
||||||
|
>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Unit">
|
||||||
|
<directory>tests/Unit</directory>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite name="Feature">
|
||||||
|
<directory>tests/Feature</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
|
<source>
|
||||||
|
<include>
|
||||||
|
<directory>app</directory>
|
||||||
|
</include>
|
||||||
|
</source>
|
||||||
|
<php>
|
||||||
|
<env name="APP_ENV" value="testing"/>
|
||||||
|
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||||
|
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||||
|
<env name="CACHE_STORE" value="array"/>
|
||||||
|
<env name="DB_CONNECTION" value="sqlite"/>
|
||||||
|
<env name="DB_DATABASE" value=":memory:"/>
|
||||||
|
<env name="MAIL_MAILER" value="array"/>
|
||||||
|
<env name="PULSE_ENABLED" value="false"/>
|
||||||
|
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||||
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
|
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||||
|
</php>
|
||||||
|
</phpunit>
|
25
public/.htaccess
Normal file
25
public/.htaccess
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
<IfModule mod_negotiation.c>
|
||||||
|
Options -MultiViews -Indexes
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
# Handle Authorization Header
|
||||||
|
RewriteCond %{HTTP:Authorization} .
|
||||||
|
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||||
|
|
||||||
|
# Handle X-XSRF-Token Header
|
||||||
|
RewriteCond %{HTTP:x-xsrf-token} .
|
||||||
|
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
|
||||||
|
|
||||||
|
# Redirect Trailing Slashes If Not A Folder...
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_URI} (.+)/$
|
||||||
|
RewriteRule ^ %1 [L,R=301]
|
||||||
|
|
||||||
|
# Send Requests To Front Controller...
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^ index.php [L]
|
||||||
|
</IfModule>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user