Skip to content

Commit 2145ccc

Browse files
committed
initial commit
0 parents  commit 2145ccc

116 files changed

Lines changed: 17582 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[compose.yaml]
18+
indent_size = 4

.env.example

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
APP_LOCALE=en
8+
APP_FALLBACK_LOCALE=en
9+
APP_FAKER_LOCALE=en_US
10+
11+
APP_MAINTENANCE_DRIVER=file
12+
# APP_MAINTENANCE_STORE=database
13+
14+
# PHP_CLI_SERVER_WORKERS=4
15+
16+
BCRYPT_ROUNDS=12
17+
18+
LOG_CHANNEL=stack
19+
LOG_STACK=single
20+
LOG_DEPRECATIONS_CHANNEL=null
21+
LOG_LEVEL=debug
22+
23+
DB_CONNECTION=sqlite
24+
# DB_HOST=127.0.0.1
25+
# DB_PORT=3306
26+
# DB_DATABASE=laravel
27+
# DB_USERNAME=root
28+
# DB_PASSWORD=
29+
30+
SESSION_DRIVER=database
31+
SESSION_LIFETIME=120
32+
SESSION_ENCRYPT=false
33+
SESSION_PATH=/
34+
SESSION_DOMAIN=null
35+
36+
BROADCAST_CONNECTION=log
37+
FILESYSTEM_DISK=local
38+
QUEUE_CONNECTION=database
39+
40+
CACHE_STORE=database
41+
# CACHE_PREFIX=
42+
43+
MEMCACHED_HOST=127.0.0.1
44+
45+
REDIS_CLIENT=phpredis
46+
REDIS_HOST=127.0.0.1
47+
REDIS_PASSWORD=null
48+
REDIS_PORT=6379
49+
50+
MAIL_MAILER=log
51+
MAIL_SCHEME=null
52+
MAIL_HOST=127.0.0.1
53+
MAIL_PORT=2525
54+
MAIL_USERNAME=null
55+
MAIL_PASSWORD=null
56+
MAIL_FROM_ADDRESS="hello@example.com"
57+
MAIL_FROM_NAME="${APP_NAME}"
58+
59+
AWS_ACCESS_KEY_ID=
60+
AWS_SECRET_ACCESS_KEY=
61+
AWS_DEFAULT_REGION=us-east-1
62+
AWS_BUCKET=
63+
AWS_USE_PATH_STYLE_ENDPOINT=false
64+
65+
VITE_APP_NAME="${APP_NAME}"

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
CHANGELOG.md export-ignore
10+
README.md export-ignore
11+
.github/workflows/browser-tests.yml export-ignore

.github/workflows/lint.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: linter
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- main
8+
- master
9+
- workos
10+
pull_request:
11+
branches:
12+
- develop
13+
- main
14+
- master
15+
- workos
16+
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
quality:
22+
runs-on: ubuntu-latest
23+
environment: Testing
24+
steps:
25+
- uses: actions/checkout@v6
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: '8.4'
31+
32+
- name: Add Flux Credentials Loaded From ENV
33+
run: composer config http-basic.composer.fluxui.dev "${{ secrets.FLUX_USERNAME }}" "${{ secrets.FLUX_LICENSE_KEY }}"
34+
35+
- name: Install Dependencies
36+
run: |
37+
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
38+
npm install
39+
40+
- name: Run Pint
41+
run: composer lint
42+
43+
# - name: Commit Changes
44+
# uses: stefanzweifel/git-auto-commit-action@v7
45+
# with:
46+
# commit_message: fix code style
47+
# commit_options: '--no-verify'
48+
# file_pattern: |
49+
# **/*
50+
# !.github/workflows/*

.github/workflows/tests.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- main
8+
- master
9+
- workos
10+
pull_request:
11+
branches:
12+
- develop
13+
- main
14+
- master
15+
- workos
16+
17+
jobs:
18+
ci:
19+
runs-on: ubuntu-latest
20+
environment: Testing
21+
strategy:
22+
matrix:
23+
php-version: ['8.4', '8.5']
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v6
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php-version }}
33+
tools: composer:v2
34+
coverage: xdebug
35+
36+
- name: Setup Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: '22'
40+
41+
- name: Install Node Dependencies
42+
run: npm i
43+
44+
- name: Add Flux Credentials Loaded From ENV
45+
run: composer config http-basic.composer.fluxui.dev "${{ secrets.FLUX_USERNAME }}" "${{ secrets.FLUX_LICENSE_KEY }}"
46+
47+
- name: Install Dependencies
48+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
49+
50+
- name: Copy Environment File
51+
run: cp .env.example .env
52+
53+
- name: Generate Application Key
54+
run: php artisan key:generate
55+
56+
- name: Build Assets
57+
run: npm run build
58+
59+
- name: Run Tests
60+
run: ./vendor/bin/pest

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/.phpunit.cache
2+
/node_modules
3+
/public/build
4+
/public/hot
5+
/public/storage
6+
/storage/*.key
7+
/storage/pail
8+
/vendor
9+
.env
10+
.env.backup
11+
.env.production
12+
.phpactor.json
13+
.phpunit.result.cache
14+
Homestead.json
15+
Homestead.yaml
16+
npm-debug.log
17+
yarn-error.log
18+
/auth.json
19+
/.fleet
20+
/.idea
21+
/.nova
22+
/.vscode
23+
/.zed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace App\Actions\Fortify;
4+
5+
use App\Concerns\PasswordValidationRules;
6+
use App\Concerns\ProfileValidationRules;
7+
use App\Models\User;
8+
use Illuminate\Support\Facades\Validator;
9+
use Laravel\Fortify\Contracts\CreatesNewUsers;
10+
11+
class CreateNewUser implements CreatesNewUsers
12+
{
13+
use PasswordValidationRules, ProfileValidationRules;
14+
15+
/**
16+
* Validate and create a newly registered user.
17+
*
18+
* @param array<string, string> $input
19+
*/
20+
public function create(array $input): User
21+
{
22+
Validator::make($input, [
23+
...$this->profileRules(),
24+
'password' => $this->passwordRules(),
25+
])->validate();
26+
27+
return User::create([
28+
'name' => $input['name'],
29+
'email' => $input['email'],
30+
'password' => $input['password'],
31+
]);
32+
}
33+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace App\Actions\Fortify;
4+
5+
use App\Concerns\PasswordValidationRules;
6+
use App\Models\User;
7+
use Illuminate\Support\Facades\Validator;
8+
use Laravel\Fortify\Contracts\ResetsUserPasswords;
9+
10+
class ResetUserPassword implements ResetsUserPasswords
11+
{
12+
use PasswordValidationRules;
13+
14+
/**
15+
* Validate and reset the user's forgotten password.
16+
*
17+
* @param array<string, string> $input
18+
*/
19+
public function reset(User $user, array $input): void
20+
{
21+
Validator::make($input, [
22+
'password' => $this->passwordRules(),
23+
])->validate();
24+
25+
$user->forceFill([
26+
'password' => $input['password'],
27+
])->save();
28+
}
29+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace App\Concerns;
4+
5+
use Illuminate\Validation\Rules\Password;
6+
7+
trait PasswordValidationRules
8+
{
9+
/**
10+
* Get the validation rules used to validate passwords.
11+
*
12+
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
13+
*/
14+
protected function passwordRules(): array
15+
{
16+
return ['required', 'string', Password::default(), 'confirmed'];
17+
}
18+
19+
/**
20+
* Get the validation rules used to validate the current password.
21+
*
22+
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
23+
*/
24+
protected function currentPasswordRules(): array
25+
{
26+
return ['required', 'string', 'current_password'];
27+
}
28+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace App\Concerns;
4+
5+
use App\Models\User;
6+
use Illuminate\Validation\Rule;
7+
8+
trait ProfileValidationRules
9+
{
10+
/**
11+
* Get the validation rules used to validate user profiles.
12+
*
13+
* @return array<string, array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>>
14+
*/
15+
protected function profileRules(?int $userId = null): array
16+
{
17+
return [
18+
'name' => $this->nameRules(),
19+
'email' => $this->emailRules($userId),
20+
];
21+
}
22+
23+
/**
24+
* Get the validation rules used to validate user names.
25+
*
26+
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
27+
*/
28+
protected function nameRules(): array
29+
{
30+
return ['required', 'string', 'max:255'];
31+
}
32+
33+
/**
34+
* Get the validation rules used to validate user emails.
35+
*
36+
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
37+
*/
38+
protected function emailRules(?int $userId = null): array
39+
{
40+
return [
41+
'required',
42+
'string',
43+
'email',
44+
'max:255',
45+
$userId === null
46+
? Rule::unique(User::class)
47+
: Rule::unique(User::class)->ignore($userId),
48+
];
49+
}
50+
}

0 commit comments

Comments
 (0)