Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#100 - migrate to laravel filament #120

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
APP_NAME=lmt
APP_ENV=testing
APP_KEY=base64:lt7KU4zYKH/nKJk23/1H6Z91bVs5KoOUkD68kkDSLwM=
APP_DEBUG=false
APP_URL=http://127.0.0.1
APP_TIMEZONE=Europe/Warsaw

LOG_CHANNEL=stack
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=lmt-ci
DB_USERNAME=lmt-ci
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=array
QUEUE_CONNECTION=sync
SESSION_DRIVER=array
SESSION_LIFETIME=120
FILESYSTEM_DISK=local
MAIL_MAILER=array
61 changes: 53 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,60 @@
APP_NAME=lmt
ENVIRONMENT=dev
APP_ENV=local
APP_KEY=base64:URqZeYUM/VChKM2nRWIMhz1kZ3Y4nyMKlxz4yB3WWng=
APP_DEBUG=true
APP_TIMEZONE=Europe/Warsaw
APP_URL=http://lmt.blumilk.localhost

EXTERNAL_WEBSERVER_PORT=8051
EXTERNAL_MAILPIT_DASHBOARD_PORT=8052
APP_LOCALE=pl
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=pl_PL

SMTP_HOST=lmt-dev-mailpit-container
SMTP_PORT=1025
SMTP_USERNAME=null
SMTP_PASSWORD=null
APP_MAINTENANCE_DRIVER=file

EMAIL_FROM="[email protected]"
PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=lmt-db-dev
DB_PORT=5432
DB_DATABASE=lmt
DB_USERNAME=lmt
DB_PASSWORD=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=

MAIL_MAILER=smtp
MAIL_HOST=lmt-dev-mailpit-container
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
REGISTRATION_NOTIFICATION_EMAIL="[email protected]"

VITE_APP_NAME="${APP_NAME}"

SOPS_AGE_PROD_SECRET_KEY=

DOCKER_APP_HOST_PORT=8051
DOCKER_DATABASE_HOST_PORT=8055
DOCKER_MAILPIT_DASHBOARD_HOST_PORT=8052

DOCKER_HOST_USER_ID=1000
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
62 changes: 62 additions & 0 deletions .github/workflows/check-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Checking app: testing and linting PHP"

on:
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- 'env.ci'

jobs:
test-and-lint-php:
name: Test & lint PHP codebase
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
services:
pgsql:
image: postgres:16.3-alpine3.18@sha256:64e18e8fb3e9c9aac89ac590c5dd8306b862478404f76cd9b5f7720d012b4c47
env:
POSTGRES_DB: lmt-ci
POSTGRES_USER: lmt-ci
POSTGRES_PASSWORD: password
options: >-
--health-cmd pg_isready
--health-interval 3s
--health-timeout 3s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 # https://github.com/actions/checkout

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 # https://github.com/actions/cache
with:
path: vendor
key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-dependencies

- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1 # https://github.com/shivammathur/setup-php
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, intl
coverage: none

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-suggest

- name: Run PHP linter
run: composer cs

- name: Execute tests
run: php artisan test --env=ci
17 changes: 17 additions & 0 deletions .github/workflows/title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Check the PR title"

on:
pull_request:
branches:
- main
types:
- opened
- edited
- synchronize

jobs:
check-pr-title:
name: Check the PR title
runs-on: ubuntu-22.04
steps:
- uses: blumilksoftware/action-pr-title@e05fc76a1cc45b33644f1de51218be43ac121dd0 # v1.2.0
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,26 @@
!/cache/.gitkeep
node_modules/
output.css
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.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
.php-cs-fixer.cache
5 changes: 0 additions & 5 deletions .prettierignore

This file was deleted.

10 changes: 0 additions & 10 deletions .prettierrc

This file was deleted.

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ CURRENT_USER_GROUP_ID = $(shell id --group)
CURRENT_DIR = $(shell pwd)
PHP_SERVICE_NAME=app

DATABASE_USERNAME=lmt
TEST_DATABASE_NAME=lmt-test

build:
docker compose build --pull

run:
docker compose up -d

tailwind:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx tailwindcss -i ./styles.css -o ./public/output.css

dev:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx tailwindcss -i ./styles.css -o ./public/output.css --watch
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npm run dev

stop:
docker compose stop

restart: stop run

lint:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx prettier . --check
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npm run lint

lintf:
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npx prettier . --write
docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} npm run lintf

shell:
@docker compose exec --user ${CURRENT_USER_ID} ${PHP_SERVICE_NAME} bash
Expand Down
46 changes: 46 additions & 0 deletions app/Enums/CompanyType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Blumilksoftware\Lmt\Enums;

use Filament\Support\Contracts\HasLabel;

enum CompanyType: string implements HasLabel
{
case Host = "host";
case Partner = "partner";
case Sponsor = "sponsor";
case Patron = "patron";
case Division = "division";

public static function available(): array
{
return collect([
self::Host,
self::Patron,
self::Sponsor,
self::Partner,
])
->mapWithKeys(fn(CompanyType $type) => [
$type->value => $type->getLabel(),
])
->toArray();
}

public function getLabel(): ?string
{
return match ($this) {
self::Host => "Organizator",
self::Partner => "Partner",
self::Sponsor => "Sponsor",
self::Patron => "Patronat",
self::Division => "Podział",
};
}

public function isDivision(): bool
{
return $this === CompanyType::Division;
}
}
Loading
Loading