Compare commits

...

9 Commits

Author SHA1 Message Date
1b71b88923 feat: wire Resend mail and Cloudflare R2 storage
Add production provider deps/config so transactional email and CMS
media can use Resend and a dedicated r2 disk with custom-domain URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 20:51:44 -03:00
3dc1f449ee feat: ship public site with SEO and visuals (#3)
* feat: ship public site with SEO and visuals

Publish CMS content on public routes with responsive media,
accessibility checks, and deterministic visual baselines.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: make browser visual CI deterministic for media

Mount host public storage into FrankenPHP so seeded fixtures are served,
and replace PNG-as-JPG fixtures with real JPEGs so Chromium can render them.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: serve public media on same-origin storage paths

Pest Browser hosts on 127.0.0.1:port while Storage::url used
http://localhost, so screenshots captured broken images. Use relative
/storage URLs for media and absolutize only OG tags via url().

Co-authored-by: Cursor <cursoragent@cursor.com>

* test: refresh visual baselines from CI Ubuntu screenshots

Media now loads on same-origin /storage paths, so baselines must
capture the rendered fixtures. Use full-page snapshots from the CI
runner to keep Pest's exact snapshot match stable across environments.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 10:12:24 -03:00
7a858b52af feat: implement CMS for content management (WEB-02/03/04/06)
Introduces Filament management for site settings, services, portfolio cases, and testimonials with admin-only policies, validated media uploads, and deterministic seeding. Includes comprehensive design and task documentation for the implementation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 06:18:42 -03:00
7a70b44931 chore: align package-lock name with site-amare
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-29 06:16:22 -03:00
18f9ec85e7 Merge pull request #2 from manoel-freitas/feature/build-content-cms 2026-07-29 05:47:39 -03:00
02f2fc506d docs: add repository contributor guide 2026-07-29 00:05:50 -03:00
59bc624fa8 fix(cms): validate media extensions and OG alt text 2026-07-28 23:57:45 -03:00
8da8d19504 feat: CMS de conteúdo do site (WEB-02/03/04/06)
Implementa gestão Filament de configurações, serviços, portfólio e depoimentos com policies admin-only, upload validado e seed determinístico.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-28 23:16:25 -03:00
236a7d3ea9 feat: Fase 0 — Fundação (setup-foundation) (#1)
* docs(openspec): propose setup-foundation change

Add OpenSpec change for SPEC Phase 0 — Foundation with proposal,
design, capability specs, and implementation tasks. Populate
openspec/config.yaml with project context and artifact rules.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: bootstrap Laravel 13 foundation (Fase 0)

Implement OpenSpec change setup-foundation: Laravel 13 + Filament 5
admin panel, Livewire 4 public site shell, PostgreSQL via Compose,
design tokens, role-based auth, quality gates (Pint/Larastan/Pest),
FrankenPHP Dockerfile, and GitHub Actions CI with five blocking jobs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ci): use valid APP_KEY for encryption in tests

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 22:05:25 -03:00
310 changed files with 28339 additions and 31 deletions

19
.dockerignore Normal file
View File

@@ -0,0 +1,19 @@
.git
.github
.codex
.cursor
.env
.env.*
!.env.example
node_modules
vendor
storage/logs
storage/framework/cache
storage/framework/sessions
storage/framework/views
bootstrap/cache
tests
.phpunit.result.cache
coverage
.worktrees
worktrees

18
.editorconfig Normal file
View 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
[{compose,docker-compose}.{yml,yaml}]
indent_size = 4

84
.env.example Normal file
View File

@@ -0,0 +1,84 @@
APP_NAME=Amare
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=pt_BR
APP_FALLBACK_LOCALE=pt_BR
APP_FAKER_LOCALE=pt_BR
APP_TIMEZONE=America/Fortaleza
# Freeze application clock outside production (visual regression / deterministic seeds).
# Example: APP_FROZEN_NOW=2026-03-15T12:00:00-03:00
# Ignored when APP_ENV=production.
# APP_FROZEN_NOW=
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=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=amare
DB_USERNAME=amare
DB_PASSWORD=secret
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
# Local/CI: log or array. Production transactional email: MAIL_MAILER=resend
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}"
# Required when MAIL_MAILER=resend
RESEND_API_KEY=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
# Cloudflare R2 (production object storage). Set FILESYSTEM_DISK=r2 in production.
# R2_URL must be the custom domain mapped to the bucket (e.g. https://media.example.com).
# R2_ENDPOINT example: https://<account_id>.r2.cloudflarestorage.com
R2_ACCESS_KEY_ID=
R2_SECRET_ACCESS_KEY=
R2_BUCKET=
R2_ENDPOINT=
R2_URL=
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@@ -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

257
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,257 @@
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
APP_ENV: testing
APP_KEY: base64:NXm/6jIyFcDGHoMKGc5QZuSaq0dRZFYPg1Isuy1fNvE=
APP_LOCALE: pt_BR
APP_FALLBACK_LOCALE: pt_BR
APP_TIMEZONE: America/Fortaleza
BCRYPT_ROUNDS: 4
CACHE_STORE: database
DB_CONNECTION: pgsql
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_DATABASE: amare_test
DB_USERNAME: amare
DB_PASSWORD: secret
QUEUE_CONNECTION: database
SESSION_DRIVER: database
jobs:
static:
name: static
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, bcmath, intl, sodium, gd
coverage: none
- uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
restore-keys: composer-${{ runner.os }}-
- run: composer validate --strict
- run: composer install --no-interaction --prefer-dist
- run: composer pint:check
- run: composer phpstan
- run: composer audit
unit:
name: unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, bcmath, intl, sodium, gd
coverage: none
- uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
restore-keys: composer-${{ runner.os }}-
- run: composer install --no-interaction --prefer-dist
- run: npm ci
- run: npm run build
- run: composer test:unit
feature:
name: feature
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: amare_test
POSTGRES_USER: amare
POSTGRES_PASSWORD: secret
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U amare -d amare_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, bcmath, intl, sodium, gd
coverage: none
- uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
restore-keys: composer-${{ runner.os }}-
- uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-${{ runner.os }}-
- run: composer install --no-interaction --prefer-dist
- run: npm ci
- run: npm run build
- run: php artisan migrate --force
- run: composer test:feature
browser:
name: browser
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: amare_test
POSTGRES_USER: amare
POSTGRES_PASSWORD: secret
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U amare -d amare_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, bcmath, intl, sodium, gd
coverage: none
- uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
restore-keys: composer-${{ runner.os }}-
- uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-${{ runner.os }}-
- run: composer install --no-interaction --prefer-dist
- run: npm ci
- run: npm run build
- run: npx playwright install chromium --with-deps
- run: php artisan migrate --force
- run: php artisan db:seed --class=VisualContentSeeder --force
- run: php artisan storage:link
- name: Build application image
run: docker build -t amare-app:ci .
- name: Run browser tests against FrankenPHP container
env:
APP_FROZEN_NOW: "2026-03-15T12:00:00-03:00"
run: |
docker run -d --name amare-web \
-e APP_ENV=testing \
-e APP_KEY="${APP_KEY}" \
-e APP_URL=http://127.0.0.1:8000 \
-e APP_LOCALE=pt_BR \
-e APP_FALLBACK_LOCALE=pt_BR \
-e APP_TIMEZONE=America/Fortaleza \
-e APP_FROZEN_NOW="${APP_FROZEN_NOW}" \
-e DB_CONNECTION=pgsql \
-e DB_HOST=host.docker.internal \
-e DB_PORT=5432 \
-e DB_DATABASE=amare_test \
-e DB_USERNAME=amare \
-e DB_PASSWORD=secret \
-e SESSION_DRIVER=database \
-e CACHE_STORE=database \
-e QUEUE_CONNECTION=database \
--add-host=host.docker.internal:host-gateway \
-v "${GITHUB_WORKSPACE}/storage/app/public:/app/storage/app/public" \
-p 8000:8000 \
amare-app:ci
for i in $(seq 1 30); do
if curl -fsS http://127.0.0.1:8000/up; then
break
fi
sleep 2
done
curl -fsS http://127.0.0.1:8000/up
./vendor/bin/pest --testsuite=Browser
- name: Collect failure diagnostics
if: failure()
run: |
mkdir -p artifacts/browser
docker logs amare-web > artifacts/browser/container.log 2>&1 || true
cp -R storage/logs artifacts/browser/app-logs 2>/dev/null || true
cp -R tests/Browser/Screenshots artifacts/browser/screenshots 2>/dev/null || true
cp -R tests/.pest artifacts/browser/pest 2>/dev/null || true
- name: Upload browser failure artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: browser-failure-artifacts
path: artifacts/browser
if-no-files-found: ignore
container:
name: container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build production image
run: docker build -t amare-app:ci .
- name: Verify container healthcheck and storage link
run: |
docker run -d --name amare-health \
-e APP_ENV=production \
-e APP_KEY="${{ env.APP_KEY }}" \
-e APP_URL=http://127.0.0.1:8000 \
-e APP_DEBUG=false \
-e DB_CONNECTION=pgsql \
-e DB_HOST=127.0.0.1 \
-e DB_PORT=5432 \
-e DB_DATABASE=amare \
-e DB_USERNAME=amare \
-e DB_PASSWORD=secret \
-p 8000:8000 \
amare-app:ci
for i in $(seq 1 30); do
if curl -fsS http://127.0.0.1:8000/up; then
docker exec amare-health test -L /app/public/storage
exit 0
fi
sleep 2
done
docker logs amare-health
exit 1

28
.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.codex
/.cursor/
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/fonts-manifest.dev.json
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
_ide_helper.php
Homestead.json
Homestead.yaml
Thumbs.db
.worktrees/

2
.npmrc Normal file
View File

@@ -0,0 +1,2 @@
ignore-scripts=true
audit=true

32
AGENTS.md Normal file
View File

@@ -0,0 +1,32 @@
# Repository Guidelines
## Project Structure & Module Organization
This is a Laravel 13 application for an event-planning consultancy. Application code lives in `app/`: domain rules belong in `app/Domain`, HTTP entry points in `app/Http`, and the internal Filament 5 panel in `app/Filament`. Blade views, JavaScript, and Tailwind CSS are under `resources/`; Vite publishes browser assets to `public/`. Database migrations, factories, and seeders live in `database/`. Tests are grouped into `tests/Unit`, `tests/Architecture`, `tests/Feature`, and `tests/Browser`. Treat `SPEC.md` as the product source of truth and use `openspec/` for planned changes.
## Build, Test, and Development Commands
- `composer setup` installs PHP and npm dependencies, creates `.env`, migrates, and builds assets.
- `docker compose up -d` starts the local PostgreSQL service.
- `composer dev` runs Laravel, the queue listener, logs, and Vite together.
- `npm run build` creates the production frontend bundle.
- `composer quality` runs formatting checks, PHPStan level 5, dependency audit, and every test suite.
- `composer test:unit`, `composer test:feature`, or `composer test:browser` run focused suites.
Feature and browser tests require the `amare_test` PostgreSQL database configured in `phpunit.xml`.
## Coding Style & Naming Conventions
Follow PSR-4 and Laravel conventions: PascalCase classes, camelCase methods, and snake_case database columns. Use four spaces (two in YAML, except four in Compose files), LF endings, and UTF-8 as defined by `.editorconfig`. Every project-owned PHP file must place `declare(strict_types=1);` immediately after `<?php`. Keep domain code independent of Filament and Livewire. Run `composer pint` to format and `composer phpstan` before review.
## Testing Guidelines
Tests use Pest 4; browser coverage uses Pest Browser/Playwright. Name files by behavior, ending in `Test.php`, and add tests in the suite matching the changed layer. Feature tests use `RefreshDatabase`. Add architecture coverage for dependency-boundary changes. No numeric coverage threshold is enforced, but changed behavior must have regression coverage.
## Commit & Pull Request Guidelines
History follows Conventional Commit-style subjects, for example `feat: Fase 0 — Fundação`. Use `<type>: <imperative summary>` (`feat`, `fix`, `docs`, `test`, `chore`) and keep commits focused. Pull requests should explain scope, link the relevant issue or OpenSpec requirement, list verification commands, and include screenshots for UI changes. Ensure all CI jobs pass.
## Security & Configuration
Copy `.env.example`; never commit secrets or production credentials. Development seed credentials are local-only. Validate uploads and authorization through Laravel policies, and run `composer security-audit` after dependency changes.

63
Dockerfile Normal file
View File

@@ -0,0 +1,63 @@
# syntax=docker/dockerfile:1
ARG PHP_VERSION=8.4
FROM composer:2 AS composer
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install \
--no-dev \
--prefer-dist \
--no-interaction \
--no-scripts \
--classmap-authoritative \
--ignore-platform-req=ext-intl
COPY . .
RUN mkdir -p bootstrap/cache storage/framework/cache storage/framework/sessions storage/framework/views storage/logs \
&& composer dump-autoload --optimize --classmap-authoritative --no-scripts
FROM node:22-bookworm-slim AS frontend
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY vite.config.js ./
COPY resources ./resources
COPY public ./public
RUN npm run build
FROM dunglas/frankenphp:1-php${PHP_VERSION}-bookworm AS runtime
RUN install-php-extensions \
intl \
mbstring \
pdo_pgsql \
zip \
opcache \
pcntl \
bcmath \
sodium \
gd
RUN useradd --create-home --shell /usr/sbin/nologin --uid 1000 appuser
WORKDIR /app
COPY --from=composer --chown=appuser:appuser /app /app
COPY --from=frontend --chown=appuser:appuser /app/public/build /app/public/build
COPY docker/Caddyfile /etc/caddy/Caddyfile
RUN mkdir -p storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache \
&& chown -R appuser:appuser storage bootstrap/cache
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
USER appuser
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD curl -fsS http://127.0.0.1:8000/up || exit 1
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["frankenphp", "run", "--config", "/etc/caddy/Caddyfile"]

127
README.md Normal file
View File

@@ -0,0 +1,127 @@
# Amare Site
Aplicação Laravel 13 para assessoria de eventos (Fase 0 — Fundação).
## Requisitos
- PHP 8.5+ com extensões `pdo_pgsql`, `intl`, `mbstring`, `zip`, `sodium`
- Composer 2.x
- Node.js 22+ e npm
- Docker e Docker Compose
## Setup local
1. Copie o ambiente:
```bash
cp .env.example .env
php artisan key:generate
```
2. Suba o PostgreSQL:
```bash
docker compose up -d
```
3. Instale dependências e rode migrations:
```bash
composer install
npm install
php artisan migrate
```
4. (Opcional) Seed de desenvolvimento:
```bash
php artisan db:seed
```
5. Servidor de desenvolvimento:
```bash
php artisan serve
npm run dev
```
Painel interno: `/admin`
Healthcheck: `GET /up`
## Variáveis principais
| Variável | Valor local |
|---|---|
| `APP_LOCALE` | `pt_BR` |
| `APP_TIMEZONE` | `America/Fortaleza` |
| `DB_CONNECTION` | `pgsql` |
| `SESSION_DRIVER` | `database` |
| `CACHE_STORE` | `database` |
| `QUEUE_CONNECTION` | `database` |
## Comandos de qualidade
```bash
composer quality # Pint + PHPStan + audit + testes
composer test:unit # Unit + Architecture
composer test:feature # Feature + Livewire + Filament
composer test:browser # E2E browser
composer test # Todos os testes
```
## Banco de testes (PostgreSQL)
Feature tests usam PostgreSQL conforme `phpunit.xml` (`DB_DATABASE=amare_test`).
Crie o banco de teste uma vez (com PostgreSQL local via Docker Compose):
```bash
docker exec amare-postgres psql -U amare -d amare -c "CREATE DATABASE amare_test;"
```
## Armazenamento de mídia
Uploads de conteúdo usam o disco `public` em desenvolvimento. Crie o symlink antes de servir arquivos localmente:
```bash
php artisan storage:link
```
Em produção, configure `FILESYSTEM_DISK=r2` (Cloudflare R2). O disco legado `s3` continua suportado se necessário.
## Provedores de produção
Produção usa **Resend** (e-mail transacional) e **Cloudflare R2** (mídia pública via domínio customizado). Local e CI permanecem com defaults seguros (`MAIL_MAILER=log`/`array`, disco `public`).
### Checklist de variáveis (produção)
| Variável | Valor |
|---|---|
| `MAIL_MAILER` | `resend` |
| `RESEND_API_KEY` | API key Resend |
| `MAIL_FROM_ADDRESS` / `MAIL_FROM_NAME` | Remetente verificado no Resend |
| `FILESYSTEM_DISK` | `r2` |
| `R2_ACCESS_KEY_ID` | Access key do token R2 |
| `R2_SECRET_ACCESS_KEY` | Secret do token R2 |
| `R2_BUCKET` | Nome do bucket |
| `R2_ENDPOINT` | `https://<account_id>.r2.cloudflarestorage.com` |
| `R2_URL` | Domínio customizado público (ex.: `https://media.example.com`) |
Infra manual (fora do app): criar bucket R2, token API, mapear domínio customizado ao bucket, criar API key Resend e verificar domínio de envio.
## Credenciais de desenvolvimento
Após `php artisan db:seed`:
| Papel | E-mail | Senha |
|---|---|---|
| Admin | `admin@amare.local` | `password` |
**Somente para ambiente local.** Nunca usar em produção.
## Documentação normativa
- [SPEC.md](SPEC.md) — especificação do produto
- [docs/adr/](docs/adr/) — ADRs aceitas
- [docs/conventions/php-strict-types.md](docs/conventions/php-strict-types.md) — convenção de strict types

28
SPEC.md
View File

@@ -2330,21 +2330,21 @@ O agente deve implementar na sequência, salvo instrução explícita.
### Fase 1 — Site e CMS ### Fase 1 — Site e CMS
- [ ] `site_settings`; - [x] `site_settings`;
- [ ] serviços; - [x] serviços;
- [ ] portfólio e galeria; - [x] portfólio e galeria;
- [ ] depoimentos; - [x] depoimentos;
- [ ] home; - [x] home;
- [ ] listagem e detalhe de serviços; - [x] listagem e detalhe de serviços;
- [ ] listagem e detalhe de portfólio; - [x] listagem e detalhe de portfólio;
- [ ] sobre; - [x] sobre;
- [ ] privacidade; - [x] privacidade;
- [ ] SEO; - [x] SEO;
- [ ] mídia otimizada; - [x] mídia otimizada;
- [ ] snapshots desktop/mobile; - [x] snapshots desktop/mobile;
- [ ] testes de acessibilidade. - [x] testes de acessibilidade.
**Critério de saída:** conteúdo gerenciável no Filament e site público aprovado visualmente. **Critério de saída:** conteúdo gerenciável no Filament e site público aprovado visualmente (baselines em `tests/.pest/snapshots/`; aprovação humana do diff visual no PR).
### Fase 2 — Leads ### Fase 2 — Leads

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace App\Application\Data;
use App\Models\PortfolioCase;
use App\Models\Service;
use App\Models\SiteSetting;
use App\Models\Testimonial;
use Illuminate\Database\Eloquent\Collection;
final readonly class HomeContent
{
/**
* @param Collection<int, Service> $featuredServices
* @param Collection<int, PortfolioCase> $featuredCases
* @param Collection<int, Testimonial> $testimonials
*/
public function __construct(
public SiteSetting $settings,
public Collection $featuredServices,
public Collection $featuredCases,
public Collection $testimonials,
) {}
}

View File

@@ -0,0 +1,103 @@
<?php
declare(strict_types=1);
namespace App\Application\Data;
use App\Models\PortfolioCase;
use App\Models\SiteSetting;
use Illuminate\Support\Facades\Storage;
final readonly class PageMeta
{
/**
* @param array<string, mixed>|null $jsonLd
*/
public function __construct(
public string $title,
public string $description,
public string $canonical,
public string $ogType = 'website',
public ?string $ogImageUrl = null,
public ?string $ogImageAlt = null,
public ?array $jsonLd = null,
) {}
/**
* @param array<string, mixed>|null $jsonLd
*/
public static function forPage(
string $canonical,
SiteSetting $settings,
?string $title = null,
?string $description = null,
?string $ogImageUrl = null,
?string $ogImageAlt = null,
string $ogType = 'website',
?array $jsonLd = null,
): self {
return new self(
title: filled($title) ? (string) $title : self::defaultTitle($settings),
description: filled($description) ? (string) $description : self::defaultDescription($settings),
canonical: $canonical,
ogType: $ogType,
ogImageUrl: $ogImageUrl ?? self::defaultOgImageUrl($settings),
ogImageAlt: $ogImageAlt ?? $settings->default_og_image_alt,
jsonLd: $jsonLd,
);
}
/**
* @param array<string, mixed>|null $jsonLd
*/
public static function forCase(
PortfolioCase $case,
string $canonical,
SiteSetting $settings,
?array $jsonLd = null,
): self {
$title = filled($case->meta_title) ? (string) $case->meta_title : (string) $case->title;
$description = filled($case->meta_description)
? (string) $case->meta_description
: (filled($case->summary) ? (string) $case->summary : self::defaultDescription($settings));
$ogImageUrl = filled($case->cover_image_path)
? url(Storage::disk('public')->url((string) $case->cover_image_path))
: self::defaultOgImageUrl($settings);
$ogImageAlt = filled($case->cover_image_alt)
? (string) $case->cover_image_alt
: $settings->default_og_image_alt;
return new self(
title: $title,
description: $description,
canonical: $canonical,
ogType: 'article',
ogImageUrl: $ogImageUrl,
ogImageAlt: $ogImageAlt,
jsonLd: $jsonLd,
);
}
private static function defaultTitle(SiteSetting $settings): string
{
return filled($settings->default_meta_title)
? (string) $settings->default_meta_title
: (string) $settings->brand_name;
}
private static function defaultDescription(SiteSetting $settings): string
{
return (string) ($settings->default_meta_description ?? '');
}
private static function defaultOgImageUrl(SiteSetting $settings): ?string
{
if (! filled($settings->default_og_image_path)) {
return null;
}
return url(Storage::disk('public')->url((string) $settings->default_og_image_path));
}
}

View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace App\Application\Queries\Marketing;
use App\Models\PortfolioCase;
final class FindPublishedPortfolioCaseBySlug
{
public function __invoke(string $slug): ?PortfolioCase
{
return PortfolioCase::query()
->published()
->with(['images'])
->where('slug', $slug)
->first();
}
}

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace App\Application\Queries\Marketing;
use App\Application\Data\HomeContent;
use App\Models\PortfolioCase;
use App\Models\Service;
use App\Models\SiteSetting;
use App\Models\Testimonial;
final class GetHomeContent
{
public function __invoke(): HomeContent
{
return new HomeContent(
settings: SiteSetting::instance(),
featuredServices: Service::query()
->published()
->where('is_featured', true)
->orderBy('sort_order')
->get(),
featuredCases: PortfolioCase::query()
->published()
->where('is_featured', true)
->with(['images'])
->orderBy('sort_order')
->get(),
testimonials: Testimonial::query()
->published()
->orderBy('sort_order')
->get(),
);
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace App\Application\Queries\Marketing;
use App\Models\PortfolioCase;
use Illuminate\Database\Eloquent\Collection;
final class GetPublishedPortfolioCases
{
/**
* @return Collection<int, PortfolioCase>
*/
public function __invoke(): Collection
{
return PortfolioCase::query()
->published()
->with(['images'])
->orderBy('sort_order')
->get();
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Application\Queries\Marketing;
use App\Models\Service;
use Illuminate\Database\Eloquent\Collection;
final class GetPublishedServices
{
/**
* @return Collection<int, Service>
*/
public function __invoke(): Collection
{
return Service::query()
->published()
->orderBy('sort_order')
->get();
}
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace App\Application\Queries\Marketing;
use App\Models\PortfolioCase;
use Illuminate\Support\Carbon;
final class GetSitemapEntries
{
/**
* @return list<array{loc: string, lastmod: string|null}>
*/
public function __invoke(): array
{
$entries = [
['loc' => route('home'), 'lastmod' => null],
['loc' => route('services.index'), 'lastmod' => null],
['loc' => route('portfolio.index'), 'lastmod' => null],
['loc' => route('about'), 'lastmod' => null],
['loc' => route('privacy'), 'lastmod' => null],
['loc' => route('contact'), 'lastmod' => null],
];
$cases = PortfolioCase::query()
->published()
->orderBy('sort_order')
->get(['slug', 'updated_at']);
foreach ($cases as $case) {
/** @var Carbon|null $updatedAt */
$updatedAt = $case->updated_at;
$entries[] = [
'loc' => route('portfolio.show', $case->slug),
'lastmod' => $updatedAt?->toAtomString(),
];
}
return $entries;
}
}

View File

@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use App\Models\PortfolioCase;
use App\Models\PortfolioImage;
use App\Models\Service;
use App\Models\SiteSetting;
use App\Models\Testimonial;
use App\Support\PublicImageUploadRules;
use App\Support\ResponsiveImage;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
final class MediaGenerateVariantsCommand extends Command
{
protected $signature = 'media:generate-variants';
protected $description = 'Generate responsive image variants for existing public media';
public function handle(): int
{
$disk = PublicImageUploadRules::disk();
$paths = $this->collectPaths();
$generated = 0;
$skipped = 0;
foreach ($paths as $path) {
if (! Storage::disk($disk)->exists($path)) {
$this->warn("Missing file: {$path}");
$skipped++;
continue;
}
ResponsiveImage::generate($path, $disk);
$generated++;
$this->line("Generated variants for {$path}");
}
$this->info("Done. Generated: {$generated}. Skipped: {$skipped}.");
return self::SUCCESS;
}
/**
* @return list<string>
*/
private function collectPaths(): array
{
$paths = [];
$settings = SiteSetting::query()->first();
if ($settings && filled($settings->default_og_image_path)) {
$paths[] = (string) $settings->default_og_image_path;
}
foreach (Service::query()->whereNotNull('cover_image_path')->pluck('cover_image_path') as $path) {
$paths[] = (string) $path;
}
foreach (PortfolioCase::query()->whereNotNull('cover_image_path')->pluck('cover_image_path') as $path) {
$paths[] = (string) $path;
}
foreach (PortfolioImage::query()->whereNotNull('path')->pluck('path') as $path) {
$paths[] = (string) $path;
}
foreach (Testimonial::query()->whereNotNull('photo_path')->pluck('photo_path') as $path) {
$paths[] = (string) $path;
}
return array_values(array_unique($paths));
}
}

View File

@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace App\Domain;
/**
* Marker class establishing the Domain namespace for architecture tests.
* Domain logic will be added in later phases.
*/
final class DomainModule {}

19
app/Enums/UserRole.php Normal file
View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace App\Enums;
enum UserRole: string
{
case Admin = 'admin';
case Assistant = 'assistant';
public function label(): string
{
return match ($this) {
self::Admin => 'Administrador',
self::Assistant => 'Assistente',
};
}
}

View File

@@ -0,0 +1,244 @@
<?php
declare(strict_types=1);
namespace App\Filament\Pages;
use App\Models\SiteSetting;
use App\Support\PublicImageUploadRules;
use BackedEnum;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Forms\Components\KeyValue;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Notifications\Notification;
use Filament\Pages\Concerns\CanUseDatabaseTransactions;
use Filament\Pages\Page;
use Filament\Schemas\Components\Actions;
use Filament\Schemas\Components\Component;
use Filament\Schemas\Components\EmbeddedSchema;
use Filament\Schemas\Components\Form;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Support\Exceptions\Halt;
use Filament\Support\Facades\FilamentView;
use Filament\Support\Icons\Heroicon;
use Livewire\Attributes\Locked;
use Throwable;
use UnitEnum;
/**
* @property-read Schema $form
*/
class ManageSiteSettings extends Page
{
use CanUseDatabaseTransactions;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCog6Tooth;
protected static ?string $navigationLabel = 'Configurações';
protected static ?string $title = 'Configurações do site';
protected static string|UnitEnum|null $navigationGroup = 'Conteúdo do site';
protected static ?int $navigationSort = 1;
/**
* @var array<string, mixed>|null
*/
public ?array $data = [];
#[Locked]
public SiteSetting $record;
public static function canAccess(): bool
{
$user = auth()->user();
return $user !== null && $user->isAdmin();
}
public function mount(): void
{
$this->record = SiteSetting::instance();
abort_unless(auth()->user()?->can('update', $this->record), 403);
$this->fillForm();
}
public function hydrate(): void
{
abort_unless(auth()->user()?->can('update', $this->record), 403);
}
protected function fillForm(): void
{
$this->form->fill($this->record->attributesToArray());
}
public function save(): void
{
try {
$this->beginDatabaseTransaction();
$data = $this->form->getState();
$this->record->update($data);
} catch (Halt $exception) {
$exception->shouldRollbackDatabaseTransaction() ?
$this->rollBackDatabaseTransaction() :
$this->commitDatabaseTransaction();
return;
} catch (Throwable $exception) {
$this->rollBackDatabaseTransaction();
throw $exception;
}
$this->commitDatabaseTransaction();
Notification::make()
->success()
->title('Configurações salvas com sucesso.')
->send();
if ($redirectUrl = $this->getRedirectUrl()) {
$this->redirect($redirectUrl, navigate: FilamentView::hasSpaMode($redirectUrl));
}
}
protected function getRedirectUrl(): ?string
{
return null;
}
public function defaultForm(Schema $schema): Schema
{
return $schema
->operation('edit')
->model($this->record)
->statePath('data');
}
public function form(Schema $schema): Schema
{
return $schema
->components([
Section::make('Marca e hero')
->schema([
TextInput::make('brand_name')
->label('Nome da marca')
->required()
->maxLength(255),
TextInput::make('hero_eyebrow')
->label('Eyebrow do hero')
->maxLength(255),
TextInput::make('hero_title')
->label('Título do hero')
->required()
->maxLength(255),
Textarea::make('hero_subtitle')
->label('Subtítulo do hero')
->required()
->rows(3),
TextInput::make('hero_cta_label')
->label('Texto do CTA')
->required()
->maxLength(255),
Textarea::make('about_summary')
->label('Resumo institucional')
->rows(3),
])
->columns(2),
Section::make('Contato')
->schema([
TextInput::make('email')
->label('E-mail')
->email()
->required()
->maxLength(255),
TextInput::make('phone')
->label('Telefone')
->required()
->maxLength(255),
TextInput::make('city')
->label('Cidade')
->maxLength(255),
KeyValue::make('social_links')
->label('Redes sociais')
->keyLabel('Rede')
->valueLabel('URL')
->addActionLabel('Adicionar rede'),
])
->columns(2),
Section::make('SEO padrão')
->schema([
TextInput::make('default_meta_title')
->label('Meta title padrão')
->required()
->maxLength(255),
Textarea::make('default_meta_description')
->label('Meta description padrão')
->required()
->rows(3),
PublicImageUploadRules::fileUpload('default_og_image_path', 'Imagem Open Graph padrão', 'content/og'),
PublicImageUploadRules::altTextField('default_og_image_alt', 'default_og_image_path'),
]),
Section::make('Analytics')
->schema([
Toggle::make('analytics_enabled')
->label('Analytics habilitado')
->default(false),
Textarea::make('analytics_script')
->label('Script de analytics')
->rows(4)
->visible(fn (callable $get): bool => (bool) $get('analytics_enabled')),
]),
]);
}
/**
* @return array<Action|ActionGroup>
*/
protected function getFormActions(): array
{
return [
Action::make('save')
->label('Salvar')
->submit('save')
->keyBindings(['mod+s']),
];
}
public function content(Schema $schema): Schema
{
return $schema
->components([
$this->getFormContentComponent(),
]);
}
public function getFormContentComponent(): Component
{
return Form::make([EmbeddedSchema::make('form')])
->id('form')
->livewireSubmitHandler('save')
->footer([
Actions::make($this->getFormActions())
->alignment($this->getFormActionsAlignment())
->fullWidth($this->hasFullWidthFormActions())
->sticky($this->areFormActionsSticky())
->key('form-actions'),
]);
}
protected function hasFullWidthFormActions(): bool
{
return false;
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\PortfolioCases\Pages;
use App\Filament\Resources\PortfolioCases\PortfolioCaseResource;
use Filament\Resources\Pages\CreateRecord;
class CreatePortfolioCase extends CreateRecord
{
protected static string $resource = PortfolioCaseResource::class;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\PortfolioCases\Pages;
use App\Filament\Resources\PortfolioCases\PortfolioCaseResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditPortfolioCase extends EditRecord
{
protected static string $resource = PortfolioCaseResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\PortfolioCases\Pages;
use App\Filament\Resources\PortfolioCases\PortfolioCaseResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListPortfolioCases extends ListRecords
{
protected static string $resource = PortfolioCaseResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,65 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\PortfolioCases;
use App\Filament\Resources\PortfolioCases\Pages\CreatePortfolioCase;
use App\Filament\Resources\PortfolioCases\Pages\EditPortfolioCase;
use App\Filament\Resources\PortfolioCases\Pages\ListPortfolioCases;
use App\Filament\Resources\PortfolioCases\RelationManagers\ImagesRelationManager;
use App\Filament\Resources\PortfolioCases\Schemas\PortfolioCaseForm;
use App\Filament\Resources\PortfolioCases\Tables\PortfolioCasesTable;
use App\Models\PortfolioCase;
use App\Policies\PortfolioCasePolicy;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
class PortfolioCaseResource extends Resource
{
protected static ?string $model = PortfolioCase::class;
protected static ?string $policy = PortfolioCasePolicy::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPhoto;
protected static ?string $navigationLabel = 'Portfólio';
protected static ?string $modelLabel = 'caso';
protected static ?string $pluralModelLabel = 'portfólio';
protected static string|UnitEnum|null $navigationGroup = 'Conteúdo do site';
protected static ?int $navigationSort = 3;
public static function form(Schema $schema): Schema
{
return PortfolioCaseForm::configure($schema);
}
public static function table(Table $table): Table
{
return PortfolioCasesTable::configure($table);
}
public static function getRelations(): array
{
return [
ImagesRelationManager::class,
];
}
public static function getPages(): array
{
return [
'index' => ListPortfolioCases::route('/'),
'create' => CreatePortfolioCase::route('/create'),
'edit' => EditPortfolioCase::route('/{record}/edit'),
];
}
}

View File

@@ -0,0 +1,76 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\PortfolioCases\RelationManagers;
use App\Support\PublicImageUploadRules;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class ImagesRelationManager extends RelationManager
{
protected static string $relationship = 'images';
protected static ?string $title = 'Galeria';
protected static ?string $modelLabel = 'imagem';
protected static ?string $pluralModelLabel = 'galeria';
public function form(Schema $schema): Schema
{
return $schema
->components([
PublicImageUploadRules::fileUpload('path', 'Imagem', 'content/portfolio'),
PublicImageUploadRules::altTextField('alt_text', 'path'),
TextInput::make('caption')
->label('Legenda')
->maxLength(255),
TextInput::make('sort_order')
->label('Ordem')
->numeric()
->default(0)
->required(),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('alt_text')
->columns([
TextColumn::make('alt_text')
->label('Texto alternativo')
->searchable(),
TextColumn::make('caption')
->label('Legenda'),
TextColumn::make('sort_order')
->label('Ordem')
->sortable(),
])
->defaultSort('sort_order')
->reorderable('sort_order')
->headerActions([
CreateAction::make(),
])
->recordActions([
EditAction::make(),
DeleteAction::make()
->requiresConfirmation(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@@ -0,0 +1,84 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\PortfolioCases\Schemas;
use App\Support\PublicImageUploadRules;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;
class PortfolioCaseForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('title')
->label('Título')
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(function (?string $state, callable $set, callable $get): void {
if (blank($get('slug'))) {
$set('slug', str($state)->slug()->toString());
}
}),
TextInput::make('slug')
->label('Slug')
->required()
->maxLength(255)
->unique(ignoreRecord: true),
TextInput::make('summary')
->label('Resumo')
->required()
->maxLength(255),
TextInput::make('event_type')
->label('Tipo de evento')
->required()
->maxLength(255),
TextInput::make('city')
->label('Cidade')
->maxLength(255),
TextInput::make('venue')
->label('Local')
->maxLength(255),
DatePicker::make('event_date')
->label('Data do evento'),
Textarea::make('challenge')
->label('Desafio')
->required()
->rows(4),
Textarea::make('solution')
->label('Solução')
->required()
->rows(4),
Textarea::make('result')
->label('Resultado')
->rows(4),
PublicImageUploadRules::fileUpload('cover_image_path', 'Imagem de capa'),
PublicImageUploadRules::altTextField('cover_image_alt', 'cover_image_path'),
TextInput::make('sort_order')
->label('Ordem')
->numeric()
->default(0)
->required(),
Toggle::make('is_featured')
->label('Destaque')
->default(false),
DateTimePicker::make('published_at')
->label('Publicado em')
->seconds(false),
TextInput::make('meta_title')
->label('Meta title')
->maxLength(255),
Textarea::make('meta_description')
->label('Meta description')
->rows(3),
]);
}
}

View File

@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\PortfolioCases\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class PortfolioCasesTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('title')
->label('Título')
->searchable()
->sortable(),
TextColumn::make('event_type')
->label('Tipo')
->searchable(),
IconColumn::make('is_featured')
->label('Destaque')
->boolean(),
TextColumn::make('published_at')
->label('Publicado em')
->dateTime()
->sortable(),
TextColumn::make('sort_order')
->label('Ordem')
->sortable(),
])
->defaultSort('sort_order')
->filters([
//
])
->recordActions([
EditAction::make(),
DeleteAction::make()
->requiresConfirmation(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Services\Pages;
use App\Filament\Resources\Services\ServiceResource;
use Filament\Resources\Pages\CreateRecord;
class CreateService extends CreateRecord
{
protected static string $resource = ServiceResource::class;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Services\Pages;
use App\Filament\Resources\Services\ServiceResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditService extends EditRecord
{
protected static string $resource = ServiceResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Services\Pages;
use App\Filament\Resources\Services\ServiceResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListServices extends ListRecords
{
protected static string $resource = ServiceResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Services\Schemas;
use App\Support\PublicImageUploadRules;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;
class ServiceForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('title')
->label('Título')
->required()
->maxLength(255)
->live(onBlur: true)
->afterStateUpdated(function (?string $state, callable $set, callable $get): void {
if (blank($get('slug'))) {
$set('slug', str($state)->slug()->toString());
}
}),
TextInput::make('slug')
->label('Slug')
->required()
->maxLength(255)
->unique(ignoreRecord: true),
TextInput::make('summary')
->label('Resumo')
->required()
->maxLength(255),
Textarea::make('description')
->label('Descrição')
->required()
->rows(6),
PublicImageUploadRules::fileUpload('cover_image_path', 'Imagem de capa'),
PublicImageUploadRules::altTextField('cover_image_alt', 'cover_image_path'),
TextInput::make('sort_order')
->label('Ordem')
->numeric()
->default(0)
->required(),
Toggle::make('is_featured')
->label('Destaque')
->default(false),
DateTimePicker::make('published_at')
->label('Publicado em')
->seconds(false),
]);
}
}

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Services;
use App\Filament\Resources\Services\Pages\CreateService;
use App\Filament\Resources\Services\Pages\EditService;
use App\Filament\Resources\Services\Pages\ListServices;
use App\Filament\Resources\Services\Schemas\ServiceForm;
use App\Filament\Resources\Services\Tables\ServicesTable;
use App\Models\Service;
use App\Policies\ServicePolicy;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
class ServiceResource extends Resource
{
protected static ?string $model = Service::class;
protected static ?string $policy = ServicePolicy::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBriefcase;
protected static ?string $navigationLabel = 'Serviços';
protected static ?string $modelLabel = 'serviço';
protected static ?string $pluralModelLabel = 'serviços';
protected static string|UnitEnum|null $navigationGroup = 'Conteúdo do site';
protected static ?int $navigationSort = 2;
public static function form(Schema $schema): Schema
{
return ServiceForm::configure($schema);
}
public static function table(Table $table): Table
{
return ServicesTable::configure($table);
}
public static function getRelations(): array
{
return [];
}
public static function getPages(): array
{
return [
'index' => ListServices::route('/'),
'create' => CreateService::route('/create'),
'edit' => EditService::route('/{record}/edit'),
];
}
}

View File

@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Services\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class ServicesTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('title')
->label('Título')
->searchable()
->sortable(),
TextColumn::make('slug')
->label('Slug')
->searchable(),
IconColumn::make('is_featured')
->label('Destaque')
->boolean(),
TextColumn::make('published_at')
->label('Publicado em')
->dateTime()
->sortable(),
TextColumn::make('sort_order')
->label('Ordem')
->sortable(),
])
->defaultSort('sort_order')
->filters([
//
])
->recordActions([
EditAction::make(),
DeleteAction::make()
->requiresConfirmation(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Testimonials\Pages;
use App\Filament\Resources\Testimonials\TestimonialResource;
use Filament\Resources\Pages\CreateRecord;
class CreateTestimonial extends CreateRecord
{
protected static string $resource = TestimonialResource::class;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Testimonials\Pages;
use App\Filament\Resources\Testimonials\TestimonialResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditTestimonial extends EditRecord
{
protected static string $resource = TestimonialResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Testimonials\Pages;
use App\Filament\Resources\Testimonials\TestimonialResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListTestimonials extends ListRecords
{
protected static string $resource = TestimonialResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Testimonials\Schemas;
use App\Support\PublicImageUploadRules;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;
class TestimonialForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Textarea::make('quote')
->label('Depoimento')
->required()
->rows(4),
TextInput::make('author_name')
->label('Nome do autor')
->required()
->maxLength(255),
TextInput::make('context')
->label('Contexto')
->maxLength(255),
PublicImageUploadRules::fileUpload('photo_path', 'Foto', 'content/testimonials'),
PublicImageUploadRules::altTextField('photo_alt', 'photo_path'),
TextInput::make('sort_order')
->label('Ordem')
->numeric()
->default(0)
->required(),
Toggle::make('is_featured')
->label('Destaque')
->default(false),
DateTimePicker::make('published_at')
->label('Publicado em')
->seconds(false),
]);
}
}

View File

@@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Testimonials\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\TernaryFilter;
use Filament\Tables\Table;
class TestimonialsTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('author_name')
->label('Autor')
->searchable()
->sortable(),
TextColumn::make('quote')
->label('Depoimento')
->limit(60),
IconColumn::make('is_featured')
->label('Destaque')
->boolean(),
TextColumn::make('published_at')
->label('Publicado em')
->dateTime()
->sortable(),
TextColumn::make('sort_order')
->label('Ordem')
->sortable(),
])
->defaultSort('sort_order')
->filters([
TernaryFilter::make('is_featured')
->label('Destaque'),
])
->recordActions([
EditAction::make(),
DeleteAction::make()
->requiresConfirmation(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Testimonials;
use App\Filament\Resources\Testimonials\Pages\CreateTestimonial;
use App\Filament\Resources\Testimonials\Pages\EditTestimonial;
use App\Filament\Resources\Testimonials\Pages\ListTestimonials;
use App\Filament\Resources\Testimonials\Schemas\TestimonialForm;
use App\Filament\Resources\Testimonials\Tables\TestimonialsTable;
use App\Models\Testimonial;
use App\Policies\TestimonialPolicy;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use UnitEnum;
class TestimonialResource extends Resource
{
protected static ?string $model = Testimonial::class;
protected static ?string $policy = TestimonialPolicy::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedChatBubbleLeftRight;
protected static ?string $navigationLabel = 'Depoimentos';
protected static ?string $modelLabel = 'depoimento';
protected static ?string $pluralModelLabel = 'depoimentos';
protected static string|UnitEnum|null $navigationGroup = 'Conteúdo do site';
protected static ?int $navigationSort = 4;
public static function form(Schema $schema): Schema
{
return TestimonialForm::configure($schema);
}
public static function table(Table $table): Table
{
return TestimonialsTable::configure($table);
}
public static function getRelations(): array
{
return [];
}
public static function getPages(): array
{
return [
'index' => ListTestimonials::route('/'),
'create' => CreateTestimonial::route('/create'),
'edit' => EditTestimonial::route('/{record}/edit'),
];
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Users\Pages;
use App\Filament\Resources\Users\UserResource;
use Filament\Resources\Pages\CreateRecord;
class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Users\Pages;
use App\Filament\Resources\Users\UserResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Users\Pages;
use App\Filament\Resources\Users\UserResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListUsers extends ListRecords
{
protected static string $resource = UserResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Users\Schemas;
use App\Enums\UserRole;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Schema;
use Illuminate\Support\Facades\Hash;
class UserForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('name')
->label('Nome')
->required()
->maxLength(255),
TextInput::make('email')
->label('E-mail')
->email()
->required()
->maxLength(255)
->unique(ignoreRecord: true),
Select::make('role')
->label('Papel')
->options([
UserRole::Admin->value => UserRole::Admin->label(),
UserRole::Assistant->value => UserRole::Assistant->label(),
])
->required(),
Toggle::make('is_active')
->label('Ativo')
->default(true),
TextInput::make('password')
->label('Senha')
->password()
->revealable()
->dehydrateStateUsing(fn (?string $state): ?string => filled($state) ? Hash::make($state) : null)
->dehydrated(fn (?string $state): bool => filled($state))
->required(fn (string $operation): bool => $operation === 'create'),
]);
}
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Users\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class UsersTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('name')
->label('Nome')
->searchable(),
TextColumn::make('email')
->label('E-mail')
->searchable(),
TextColumn::make('role')
->label('Papel')
->badge()
->formatStateUsing(fn ($state): string => $state->label()),
IconColumn::make('is_active')
->label('Ativo')
->boolean(),
TextColumn::make('created_at')
->label('Criado em')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
//
])
->recordActions([
EditAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Users;
use App\Filament\Resources\Users\Pages\CreateUser;
use App\Filament\Resources\Users\Pages\EditUser;
use App\Filament\Resources\Users\Pages\ListUsers;
use App\Filament\Resources\Users\Schemas\UserForm;
use App\Filament\Resources\Users\Tables\UsersTable;
use App\Models\User;
use App\Policies\UserPolicy;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
class UserResource extends Resource
{
protected static ?string $model = User::class;
protected static ?string $policy = UserPolicy::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedUsers;
protected static ?string $navigationLabel = 'Usuários';
protected static ?string $modelLabel = 'usuário';
protected static ?string $pluralModelLabel = 'usuários';
public static function form(Schema $schema): Schema
{
return UserForm::configure($schema);
}
public static function table(Table $table): Table
{
return UsersTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListUsers::route('/'),
'create' => CreateUser::route('/create'),
'edit' => EditUser::route('/{record}/edit'),
];
}
}

View File

@@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\PublicSite;
use App\Application\Data\PageMeta;
use App\Application\Queries\Marketing\GetHomeContent;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\View;
final class HomeController extends Controller
{
public function __invoke(GetHomeContent $getHomeContent): View
{
$content = $getHomeContent();
return view('pages.home', [
'content' => $content,
'siteSettings' => $content->settings,
'pageMeta' => PageMeta::forPage(
canonical: route('home'),
settings: $content->settings,
jsonLd: [
'@context' => 'https://schema.org',
'@type' => 'Organization',
'name' => $content->settings->brand_name,
'email' => $content->settings->email,
'telephone' => $content->settings->phone,
'address' => [
'@type' => 'PostalAddress',
'addressLocality' => $content->settings->city,
],
],
),
]);
}
}

View File

@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\PublicSite;
use App\Application\Data\PageMeta;
use App\Http\Controllers\Controller;
use App\Models\SiteSetting;
use Illuminate\Contracts\View\View;
final class PageController extends Controller
{
public function about(): View
{
$settings = SiteSetting::instance();
return view('pages.about', [
'siteSettings' => $settings,
'pageMeta' => PageMeta::forPage(
canonical: route('about'),
settings: $settings,
title: 'Sobre',
description: $settings->about_summary ?: ('Conheça a '.$settings->brand_name.'.'),
),
]);
}
public function privacy(): View
{
$settings = SiteSetting::instance();
return view('pages.privacy', [
'siteSettings' => $settings,
'pageMeta' => PageMeta::forPage(
canonical: route('privacy'),
settings: $settings,
title: 'Política de privacidade',
description: 'Política de privacidade da '.$settings->brand_name.'.',
),
]);
}
public function contact(): View
{
$settings = SiteSetting::instance();
return view('pages.contact', [
'siteSettings' => $settings,
'pageMeta' => PageMeta::forPage(
canonical: route('contact'),
settings: $settings,
title: 'Contato',
description: 'Fale com a '.$settings->brand_name.'.',
),
]);
}
}

View File

@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\PublicSite;
use App\Application\Data\PageMeta;
use App\Application\Queries\Marketing\FindPublishedPortfolioCaseBySlug;
use App\Http\Controllers\Controller;
use App\Models\PortfolioCase;
use App\Models\SiteSetting;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Response;
use Illuminate\Pagination\LengthAwarePaginator;
final class PortfolioController extends Controller
{
public function index(): View
{
$settings = SiteSetting::instance();
/** @var LengthAwarePaginator<int, PortfolioCase> $cases */
$cases = PortfolioCase::query()
->published()
->with(['images'])
->orderBy('sort_order')
->paginate(9);
return view('pages.portfolio.index', [
'cases' => $cases,
'siteSettings' => $settings,
'pageMeta' => PageMeta::forPage(
canonical: route('portfolio.index'),
settings: $settings,
title: 'Portfólio',
description: 'Casos reais de eventos conduzidos pela '.$settings->brand_name.'.',
),
]);
}
public function show(string $slug, FindPublishedPortfolioCaseBySlug $findPublishedPortfolioCaseBySlug): View|Response
{
$case = $findPublishedPortfolioCaseBySlug($slug);
if ($case === null) {
abort(404);
}
$settings = SiteSetting::instance();
$canonical = route('portfolio.show', $case->slug);
return view('pages.portfolio.show', [
'case' => $case,
'siteSettings' => $settings,
'pageMeta' => PageMeta::forCase(
case: $case,
canonical: $canonical,
settings: $settings,
jsonLd: [
'@context' => 'https://schema.org',
'@type' => 'Article',
'headline' => $case->title,
'description' => $case->summary,
'url' => $canonical,
'datePublished' => $case->published_at?->toAtomString(),
'dateModified' => $case->updated_at?->toAtomString(),
],
),
]);
}
}

View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\PublicSite;
use App\Http\Controllers\Controller;
use Illuminate\Http\Response;
final class RobotsController extends Controller
{
public function __invoke(): Response
{
$body = implode("\n", [
'User-agent: *',
'Allow: /',
'Sitemap: '.url('/sitemap.xml'),
'',
]);
return response($body, 200, [
'Content-Type' => 'text/plain; charset=UTF-8',
]);
}
}

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\PublicSite;
use App\Application\Data\PageMeta;
use App\Application\Queries\Marketing\GetPublishedServices;
use App\Http\Controllers\Controller;
use App\Models\SiteSetting;
use Illuminate\Contracts\View\View;
final class ServiceController extends Controller
{
public function index(GetPublishedServices $getPublishedServices): View
{
$settings = SiteSetting::instance();
$services = $getPublishedServices();
return view('pages.services.index', [
'services' => $services,
'siteSettings' => $settings,
'pageMeta' => PageMeta::forPage(
canonical: route('services.index'),
settings: $settings,
title: 'Serviços',
description: 'Conheça os serviços de assessoria de eventos da '.$settings->brand_name.'.',
),
]);
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\PublicSite;
use App\Application\Queries\Marketing\GetSitemapEntries;
use App\Http\Controllers\Controller;
use Illuminate\Http\Response;
final class SitemapController extends Controller
{
public function __invoke(GetSitemapEntries $getSitemapEntries): Response
{
return response()
->view('pages.sitemap', [
'entries' => $getSitemapEntries(),
], 200, [
'Content-Type' => 'application/xml',
]);
}
}

View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace App\Models\Concerns;
use Illuminate\Database\Eloquent\Builder;
trait HasPublication
{
/**
* @param Builder<static> $query
* @return Builder<static>
*/
public function scopePublished(Builder $query): Builder
{
return $query->whereNotNull('published_at');
}
}

View File

@@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Models\Concerns\HasPublication;
use App\Policies\PortfolioCasePolicy;
use Database\Factories\PortfolioCaseFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\UsePolicy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
/**
* @property Carbon|null $published_at
* @property Carbon|null $event_date
*/
#[Fillable([
'title',
'slug',
'summary',
'event_type',
'city',
'venue',
'event_date',
'challenge',
'solution',
'result',
'cover_image_path',
'cover_image_alt',
'is_featured',
'sort_order',
'published_at',
'meta_title',
'meta_description',
])]
#[UsePolicy(PortfolioCasePolicy::class)]
class PortfolioCase extends Model
{
/** @use HasFactory<PortfolioCaseFactory> */
use HasFactory;
use HasPublication;
protected static function booted(): void
{
static::saving(function (PortfolioCase $portfolioCase): void {
if (blank($portfolioCase->slug) && filled($portfolioCase->title)) {
$portfolioCase->slug = Str::slug($portfolioCase->title);
}
});
}
/**
* @return HasMany<PortfolioImage, $this>
*/
public function images(): HasMany
{
return $this->hasMany(PortfolioImage::class)->orderBy('sort_order');
}
/**
* @return array<string, string|class-string>
*/
protected function casts(): array
{
return [
'is_featured' => 'boolean',
'published_at' => 'datetime',
'event_date' => 'date',
'sort_order' => 'integer',
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
#[Fillable([
'portfolio_case_id',
'path',
'alt_text',
'caption',
'sort_order',
])]
class PortfolioImage extends Model
{
/**
* @return BelongsTo<PortfolioCase, $this>
*/
public function portfolioCase(): BelongsTo
{
return $this->belongsTo(PortfolioCase::class);
}
/**
* @return array<string, string|class-string>
*/
protected function casts(): array
{
return [
'sort_order' => 'integer',
];
}
}

60
app/Models/Service.php Normal file
View File

@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Models\Concerns\HasPublication;
use App\Policies\ServicePolicy;
use Database\Factories\ServiceFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\UsePolicy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
/**
* @property Carbon|null $published_at
* @property bool $is_featured
*/
#[Fillable([
'title',
'slug',
'summary',
'description',
'cover_image_path',
'cover_image_alt',
'sort_order',
'is_featured',
'published_at',
])]
#[UsePolicy(ServicePolicy::class)]
class Service extends Model
{
/** @use HasFactory<ServiceFactory> */
use HasFactory;
use HasPublication;
protected static function booted(): void
{
static::saving(function (Service $service): void {
if (blank($service->slug) && filled($service->title)) {
$service->slug = Str::slug($service->title);
}
});
}
/**
* @return array<string, string|class-string>
*/
protected function casts(): array
{
return [
'is_featured' => 'boolean',
'published_at' => 'datetime',
'sort_order' => 'integer',
];
}
}

View File

@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Policies\SiteSettingPolicy;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\UsePolicy;
use Illuminate\Database\Eloquent\Model;
/**
* @property array<string, string|null> $social_links
* @property bool $analytics_enabled
* @property string|null $default_og_image_path
* @property string|null $default_og_image_alt
*/
#[Fillable([
'brand_name',
'hero_eyebrow',
'hero_title',
'hero_subtitle',
'hero_cta_label',
'about_summary',
'email',
'phone',
'city',
'social_links',
'default_meta_title',
'default_meta_description',
'default_og_image_path',
'default_og_image_alt',
'analytics_enabled',
'analytics_script',
])]
#[UsePolicy(SiteSettingPolicy::class)]
class SiteSetting extends Model
{
public static function instance(): self
{
return static::query()->firstOrCreate([], [
'brand_name' => 'Amare Assessoria',
'hero_eyebrow' => 'Assessoria de eventos',
'hero_title' => 'Celebrações com propósito',
'hero_subtitle' => 'Planejamento completo para casamentos e eventos corporativos.',
'hero_cta_label' => 'Solicitar orçamento',
'about_summary' => 'Assessoria boutique em Fortaleza.',
'email' => 'contato@amare.local',
'phone' => '(85) 99999-9999',
'city' => 'Fortaleza, CE',
'social_links' => [],
'default_meta_title' => 'Amare Assessoria de Eventos',
'default_meta_description' => 'Assessoria premium para casamentos e eventos corporativos.',
'analytics_enabled' => false,
]);
}
/**
* @return array<string, string|class-string>
*/
protected function casts(): array
{
return [
'social_links' => 'array',
'analytics_enabled' => 'boolean',
];
}
}

View File

@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Models\Concerns\HasPublication;
use App\Policies\TestimonialPolicy;
use Database\Factories\TestimonialFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\UsePolicy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Carbon;
/**
* @property Carbon|null $published_at
* @property bool $is_featured
*/
#[Fillable([
'quote',
'author_name',
'context',
'photo_path',
'photo_alt',
'sort_order',
'is_featured',
'published_at',
])]
#[UsePolicy(TestimonialPolicy::class)]
class Testimonial extends Model
{
/** @use HasFactory<TestimonialFactory> */
use HasFactory;
use HasPublication;
/**
* @return array<string, string|class-string>
*/
protected function casts(): array
{
return [
'is_featured' => 'boolean',
'published_at' => 'datetime',
'sort_order' => 'integer',
];
}
}

50
app/Models/User.php Normal file
View File

@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Enums\UserRole;
use Database\Factories\UserFactory;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
/**
* @property UserRole $role
* @property bool $is_active
*/
#[Fillable(['name', 'email', 'password', 'role', 'is_active'])]
#[Hidden(['password', 'remember_token'])]
class User extends Authenticatable implements FilamentUser
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
public function canAccessPanel(Panel $panel): bool
{
return $this->is_active;
}
public function isAdmin(): bool
{
return $this->role === UserRole::Admin;
}
/**
* @return array<string, string|class-string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'role' => UserRole::class,
'is_active' => 'boolean',
];
}
}

View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\PortfolioCase;
use App\Models\User;
class PortfolioCasePolicy
{
public function viewAny(User $user): bool
{
return $user->isAdmin();
}
public function view(User $user, PortfolioCase $portfolioCase): bool
{
return $user->isAdmin();
}
public function create(User $user): bool
{
return $user->isAdmin();
}
public function update(User $user, PortfolioCase $portfolioCase): bool
{
return $user->isAdmin();
}
public function delete(User $user, PortfolioCase $portfolioCase): bool
{
return $user->isAdmin();
}
public function restore(User $user, PortfolioCase $portfolioCase): bool
{
return $user->isAdmin();
}
public function forceDelete(User $user, PortfolioCase $portfolioCase): bool
{
return $user->isAdmin();
}
}

View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Service;
use App\Models\User;
class ServicePolicy
{
public function viewAny(User $user): bool
{
return $user->isAdmin();
}
public function view(User $user, Service $service): bool
{
return $user->isAdmin();
}
public function create(User $user): bool
{
return $user->isAdmin();
}
public function update(User $user, Service $service): bool
{
return $user->isAdmin();
}
public function delete(User $user, Service $service): bool
{
return $user->isAdmin();
}
public function restore(User $user, Service $service): bool
{
return $user->isAdmin();
}
public function forceDelete(User $user, Service $service): bool
{
return $user->isAdmin();
}
}

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\SiteSetting;
use App\Models\User;
class SiteSettingPolicy
{
public function viewAny(User $user): bool
{
return $user->isAdmin();
}
public function view(User $user, SiteSetting $siteSetting): bool
{
return $user->isAdmin();
}
public function create(User $user): bool
{
return $user->isAdmin();
}
public function update(User $user, SiteSetting $siteSetting): bool
{
return $user->isAdmin();
}
public function delete(User $user, SiteSetting $siteSetting): bool
{
return $user->isAdmin();
}
}

View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\Testimonial;
use App\Models\User;
class TestimonialPolicy
{
public function viewAny(User $user): bool
{
return $user->isAdmin();
}
public function view(User $user, Testimonial $testimonial): bool
{
return $user->isAdmin();
}
public function create(User $user): bool
{
return $user->isAdmin();
}
public function update(User $user, Testimonial $testimonial): bool
{
return $user->isAdmin();
}
public function delete(User $user, Testimonial $testimonial): bool
{
return $user->isAdmin();
}
public function restore(User $user, Testimonial $testimonial): bool
{
return $user->isAdmin();
}
public function forceDelete(User $user, Testimonial $testimonial): bool
{
return $user->isAdmin();
}
}

View File

@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\User;
class UserPolicy
{
public function viewAny(User $user): bool
{
return $user->isAdmin();
}
public function view(User $user, User $model): bool
{
return $user->isAdmin();
}
public function create(User $user): bool
{
return $user->isAdmin();
}
public function update(User $user, User $model): bool
{
return $user->isAdmin();
}
public function delete(User $user, User $model): bool
{
return $user->isAdmin();
}
public function restore(User $user, User $model): bool
{
return $user->isAdmin();
}
public function forceDelete(User $user, User $model): bool
{
return $user->isAdmin();
}
}

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace App\Providers;
use App\Application\Data\PageMeta;
use App\Models\SiteSetting;
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\View as ViewInstance;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
$this->freezeClockWhenConfigured();
View::composer('layouts.public', function (ViewInstance $view): void {
$settings = $view->offsetExists('siteSettings')
? $view->offsetGet('siteSettings')
: SiteSetting::instance();
if (! $view->offsetExists('siteSettings')) {
$view->with('siteSettings', $settings);
}
if (! $view->offsetExists('pageMeta')) {
$view->with('pageMeta', PageMeta::forPage(
canonical: url()->current(),
settings: $settings,
));
}
});
}
private function freezeClockWhenConfigured(): void
{
if ($this->app->environment('production')) {
return;
}
$frozenNow = config('app.frozen_now');
if (! filled($frozenNow)) {
return;
}
CarbonImmutable::setTestNow(CarbonImmutable::parse((string) $frozenNow));
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace App\Providers\Filament;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\AuthenticateSession;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages\Dashboard;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets\AccountWidget;
use Filament\Widgets\FilamentInfoWidget;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
->pages([
Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
->widgets([
AccountWidget::class,
FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
PreventRequestForgery::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}

View File

@@ -0,0 +1,95 @@
<?php
declare(strict_types=1);
namespace App\Support;
use Filament\Forms\Components\BaseFileUpload;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Utilities\Get;
use Illuminate\Validation\Rules\File;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
final class PublicImageUploadRules
{
/** @var list<string> */
public const ALLOWED_MIMES = ['image/jpeg', 'image/png', 'image/webp'];
/** @var list<string> */
public const ALLOWED_EXTENSIONS = ['jpg', 'jpeg', 'png', 'webp'];
public const MAX_SIZE_KILOBYTES = 10240;
public static function fileUpload(string $name, string $label, string $directory = 'content'): FileUpload
{
return FileUpload::make($name)
->label($label)
->disk(self::disk())
->directory($directory)
->acceptedFileTypes(self::ALLOWED_MIMES)
->maxSize(self::MAX_SIZE_KILOBYTES)
->rules(self::validationRules())
->validationMessages(self::validationMessages())
->getUploadedFileNameForStorageUsing(
fn ($file): string => (string) str()->uuid().'.'.$file->getClientOriginalExtension(),
)
->saveUploadedFileUsing(function (BaseFileUpload $component, TemporaryUploadedFile $file): ?string {
$path = $component->saveUploadedFile($file);
if (filled($path)) {
ResponsiveImage::generate((string) $path, $component->getDiskName());
}
return $path;
})
->deleteUploadedFileUsing(function (BaseFileUpload $component, string $file): void {
ResponsiveImage::delete($file, $component->getDiskName());
});
}
public static function altTextField(string $name, string $imageField, string $label = 'Texto alternativo'): TextInput
{
return TextInput::make($name)
->label($label)
->required(fn (Get $get): bool => filled($get($imageField)))
->validationMessages([
'required' => 'O texto alternativo é obrigatório quando uma imagem é enviada.',
])
->maxLength(255);
}
/**
* @return list<File|string>
*/
public static function validationRules(): array
{
return [
File::types(self::ALLOWED_EXTENSIONS)->max(self::MAX_SIZE_KILOBYTES),
'extensions:'.implode(',', self::ALLOWED_EXTENSIONS),
];
}
/**
* @return array<string, string>
*/
public static function validationMessages(): array
{
return [
'file' => 'A imagem enviada é inválida.',
'mimes' => 'A imagem deve ser um arquivo JPG, JPEG, PNG ou WEBP.',
'mimetypes' => 'A imagem deve ser um arquivo JPG, JPEG, PNG ou WEBP.',
'extensions' => 'A imagem deve ser um arquivo JPG, JPEG, PNG ou WEBP.',
'max' => 'A imagem não pode ter mais de 10 MB.',
];
}
public static function disk(): string
{
return match (config('filesystems.default')) {
'r2' => 'r2',
's3' => 's3',
default => 'public',
};
}
}

View File

@@ -0,0 +1,151 @@
<?php
declare(strict_types=1);
namespace App\Support;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Drivers\Gd\Driver;
use Intervention\Image\ImageManager;
use Throwable;
final class ResponsiveImage
{
/** @var list<int> */
public const WIDTHS = [480, 960, 1440];
public static function generate(string $path, ?string $disk = null): void
{
$filesystem = self::filesystem($disk);
if (! $filesystem->exists($path)) {
return;
}
$manager = new ImageManager(new Driver);
$contents = $filesystem->get($path);
if ($contents === null) {
return;
}
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
foreach (self::WIDTHS as $width) {
$variantPath = self::variantPath($path, $width);
$variant = $manager->read($contents);
if ($variant->width() > $width) {
$variant->scale(width: $width);
}
$encoded = match ($extension) {
'png' => $variant->toPng(),
'webp' => $variant->toWebp(quality: 82),
default => $variant->toJpeg(quality: 82),
};
$filesystem->put($variantPath, (string) $encoded);
}
}
public static function deleteVariants(string $path, ?string $disk = null): void
{
$filesystem = self::filesystem($disk);
foreach (self::WIDTHS as $width) {
$variantPath = self::variantPath($path, $width);
if ($filesystem->exists($variantPath)) {
$filesystem->delete($variantPath);
}
}
}
public static function delete(string $path, ?string $disk = null): void
{
$filesystem = self::filesystem($disk);
self::deleteVariants($path, $disk);
if ($filesystem->exists($path)) {
$filesystem->delete($path);
}
}
public static function replace(string $previousPath, string $newPath, ?string $disk = null): void
{
if ($previousPath !== '' && $previousPath !== $newPath) {
self::delete($previousPath, $disk);
}
self::generate($newPath, $disk);
}
public static function variantPath(string $path, int $width): string
{
$directory = trim(dirname($path), '.');
$filename = pathinfo($path, PATHINFO_FILENAME);
$extension = pathinfo($path, PATHINFO_EXTENSION);
$variantName = $filename.'-'.$width.($extension !== '' ? '.'.$extension : '');
return $directory === '' ? $variantName : $directory.'/'.$variantName;
}
/**
* @return list<array{path: string, width: int}>
*/
public static function availableVariants(string $path, ?string $disk = null): array
{
$filesystem = self::filesystem($disk);
$variants = [];
foreach (self::WIDTHS as $width) {
$variantPath = self::variantPath($path, $width);
if ($filesystem->exists($variantPath)) {
$variants[] = [
'path' => $variantPath,
'width' => $width,
];
}
}
return $variants;
}
/**
* @return array{width: int, height: int}|null
*/
public static function dimensions(string $path, ?string $disk = null): ?array
{
$filesystem = self::filesystem($disk);
if (! $filesystem->exists($path)) {
return null;
}
try {
$contents = $filesystem->get($path);
if ($contents === null) {
return null;
}
$image = (new ImageManager(new Driver))->read($contents);
return [
'width' => $image->width(),
'height' => $image->height(),
];
} catch (Throwable) {
return null;
}
}
private static function filesystem(?string $disk): Filesystem
{
return Storage::disk($disk ?? PublicImageUploadRules::disk());
}
}

18
artisan Executable file
View 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);

21
bootstrap/app.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Request;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->shouldRenderJsonWhen(
fn (Request $request) => $request->is('api/*'),
);
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

9
bootstrap/providers.php Normal file
View File

@@ -0,0 +1,9 @@
<?php
use App\Providers\AppServiceProvider;
use App\Providers\Filament\AdminPanelProvider;
return [
AppServiceProvider::class,
AdminPanelProvider::class,
];

125
composer.json Normal file
View File

@@ -0,0 +1,125 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.3",
"filament/filament": "^5.0",
"intervention/image": "^3.0",
"laravel/framework": "^13.8",
"laravel/tinker": "^3.0",
"league/flysystem-aws-s3-v3": "^3.35",
"resend/resend-php": "^1.7"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"larastan/larastan": "^3.10",
"laravel/pail": "^1.2.5",
"laravel/pint": "^1.27",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"pestphp/pest": "^4.7",
"pestphp/pest-plugin-browser": "^4.3",
"pestphp/pest-plugin-laravel": "^4.1",
"phpunit/phpunit": "^12.5.12"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"setup": [
"composer install",
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php artisan key:generate",
"@php artisan migrate --force",
"npm install --ignore-scripts",
"npm run build"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
],
"test": [
"@test:unit",
"@test:feature",
"@test:browser"
],
"test:unit": [
"@php artisan test --testsuite=Unit,Architecture"
],
"test:feature": [
"@php artisan test --testsuite=Feature"
],
"test:browser": [
"@php artisan test --testsuite=Browser"
],
"pint": [
"vendor/bin/pint"
],
"pint:check": [
"vendor/bin/pint --test"
],
"phpstan": [
"vendor/bin/phpstan analyse --memory-limit=1G --debug"
],
"security-audit": [
"composer audit --no-interaction"
],
"quality": [
"@pint:check",
"@phpstan",
"composer audit --no-interaction",
"@test"
],
"visual:update": [
"@php artisan test --testsuite=Browser --update-snapshots"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
"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"
],
"pre-package-uninstall": [
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
]
},
"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
}

13716
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

138
config/app.php Normal file
View File

@@ -0,0 +1,138 @@
<?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', 'Laravel'),
/*
|--------------------------------------------------------------------------
| 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' => env('APP_TIMEZONE', 'America/Fortaleza'),
/*
|--------------------------------------------------------------------------
| Frozen Clock (non-production)
|--------------------------------------------------------------------------
|
| When set outside production, the application clock is frozen for
| deterministic rendering (visual regression / seeded content).
|
*/
'frozen_now' => env('APP_FROZEN_NOW'),
/*
|--------------------------------------------------------------------------
| 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', 'en'),
'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(',', (string) 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'),
],
];

117
config/auth.php Normal file
View File

@@ -0,0 +1,117 @@
<?php
use App\Models\User;
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', 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 number 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),
];

136
config/cache.php Normal file
View File

@@ -0,0 +1,136 @@
<?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", "storage", "octane",
| "session", "failover", "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'),
],
'storage' => [
'driver' => 'storage',
'disk' => env('CACHE_STORAGE_DISK'),
'path' => env('CACHE_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',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
],
/*
|--------------------------------------------------------------------------
| 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((string) env('APP_NAME', 'laravel')).'-cache-'),
/*
|--------------------------------------------------------------------------
| Serializable Classes
|--------------------------------------------------------------------------
|
| This value determines the classes that can be unserialized from cache
| storage. By default, no PHP classes will be unserialized from your
| cache to prevent gadget chain attacks if your APP_KEY is leaked.
|
*/
'serializable_classes' => false,
];

184
config/database.php Normal file
View File

@@ -0,0 +1,184 @@
<?php
use Illuminate\Support\Str;
use Pdo\Mysql;
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,
'transaction_mode' => 'DEFERRED',
],
'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([
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([
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' => env('DB_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((string) 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'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'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'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];

96
config/filesystems.php Normal file
View File

@@ -0,0 +1,96 @@
<?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'),
// Same-origin path so Pest Browser / any host:port can load media.
// Absolute URLs for OG tags should be built with url(...).
'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,
],
'r2' => [
'driver' => 's3',
'key' => env('R2_ACCESS_KEY_ID'),
'secret' => env('R2_SECRET_ACCESS_KEY'),
'region' => 'auto',
'bucket' => env('R2_BUCKET'),
'url' => env('R2_URL'),
'endpoint' => env('R2_ENDPOINT'),
'use_path_style_endpoint' => true,
'visibility' => 'public',
'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
View 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(',', (string) 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', env('APP_NAME', 'Laravel')),
'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'),
],
],
];

118
config/mail.php Normal file
View File

@@ -0,0 +1,118 @@
<?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((string) 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',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| 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', env('APP_NAME', 'Laravel')),
],
];

129
config/queue.php Normal file
View File

@@ -0,0 +1,129 @@
<?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",
| "deferred", "background", "failover", "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,
],
'deferred' => [
'driver' => 'deferred',
],
'background' => [
'driver' => 'background',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| 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',
],
];

38
config/services.php Normal file
View 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' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
];

233
config/session.php Normal file
View File

@@ -0,0 +1,233 @@
<?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", "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: "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((string) 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 without 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),
/*
|--------------------------------------------------------------------------
| Session Serialization
|--------------------------------------------------------------------------
|
| This value controls the serialization strategy for session data, which
| is JSON by default. Setting this to "php" allows the storage of PHP
| objects in the session but can make an application vulnerable to
| "gadget chain" serialization attacks if the APP_KEY is leaked.
|
| Supported: "json", "php"
|
*/
'serialization' => 'json',
];

1
database/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.sqlite*

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\PortfolioCase;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<PortfolioCase>
*/
class PortfolioCaseFactory extends Factory
{
protected $model = PortfolioCase::class;
/**
* @return array<string, mixed>
*/
public function definition(): array
{
$title = fake()->unique()->words(4, true);
return [
'title' => $title,
'slug' => str($title)->slug()->toString(),
'summary' => fake()->sentence(),
'event_type' => 'Casamento',
'city' => 'Fortaleza',
'venue' => fake()->company(),
'event_date' => fake()->date(),
'challenge' => fake()->paragraph(),
'solution' => fake()->paragraph(),
'result' => fake()->paragraph(),
'cover_image_path' => 'content/fixture-cover.jpg',
'cover_image_alt' => 'Capa do caso',
'is_featured' => false,
'sort_order' => 0,
'published_at' => null,
'meta_title' => null,
'meta_description' => null,
];
}
public function published(): static
{
return $this->state(fn (array $attributes): array => [
'published_at' => now(),
]);
}
}

View File

@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Service;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Service>
*/
class ServiceFactory extends Factory
{
protected $model = Service::class;
/**
* @return array<string, mixed>
*/
public function definition(): array
{
$title = fake()->unique()->words(3, true);
return [
'title' => $title,
'slug' => str($title)->slug()->toString(),
'summary' => fake()->sentence(),
'description' => fake()->paragraphs(2, true),
'cover_image_path' => null,
'cover_image_alt' => null,
'sort_order' => 0,
'is_featured' => false,
'published_at' => null,
];
}
public function published(): static
{
return $this->state(fn (array $attributes): array => [
'published_at' => now(),
]);
}
public function featured(): static
{
return $this->state(fn (array $attributes): array => [
'is_featured' => true,
]);
}
}

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Testimonial;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Testimonial>
*/
class TestimonialFactory extends Factory
{
protected $model = Testimonial::class;
/**
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'quote' => fake()->paragraph(),
'author_name' => fake()->name(),
'context' => fake()->optional()->jobTitle(),
'photo_path' => null,
'photo_alt' => null,
'sort_order' => 0,
'is_featured' => false,
'published_at' => null,
];
}
public function published(): static
{
return $this->state(fn (array $attributes): array => [
'published_at' => now(),
]);
}
public function featured(): static
{
return $this->state(fn (array $attributes): array => [
'is_featured' => true,
]);
}
}

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Enums\UserRole;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
protected static ?string $password;
/**
* @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),
'role' => UserRole::Assistant,
'is_active' => true,
];
}
public function admin(): static
{
return $this->state(fn (array $attributes): array => [
'role' => UserRole::Admin,
]);
}
public function assistant(): static
{
return $this->state(fn (array $attributes): array => [
'role' => UserRole::Assistant,
]);
}
public function inactive(): static
{
return $this->state(fn (array $attributes): array => [
'is_active' => false,
]);
}
public function unverified(): static
{
return $this->state(fn (array $attributes): array => [
'email_verified_at' => null,
]);
}
}

View 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');
}
};

View 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->bigInteger('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->bigInteger('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@@ -0,0 +1,59 @@
<?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->unsignedSmallInteger('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->string('connection');
$table->string('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
$table->index(['connection', 'queue', 'failed_at']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table): void {
$table->string('role')->default('assistant')->after('email');
$table->boolean('is_active')->default(true)->after('role');
$table->index('role');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table): void {
$table->dropIndex(['role']);
$table->dropColumn(['role', 'is_active']);
});
}
};

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('site_settings', function (Blueprint $table): void {
$table->id();
$table->string('brand_name');
$table->string('hero_eyebrow')->nullable();
$table->string('hero_title');
$table->text('hero_subtitle');
$table->string('hero_cta_label');
$table->text('about_summary')->nullable();
$table->string('email');
$table->string('phone');
$table->string('city')->nullable();
$table->jsonb('social_links')->default('[]');
$table->string('default_meta_title');
$table->text('default_meta_description');
$table->string('default_og_image_path')->nullable();
$table->string('default_og_image_alt')->nullable();
$table->boolean('analytics_enabled')->default(false);
$table->text('analytics_script')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('site_settings');
}
};

View File

@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('services', function (Blueprint $table): void {
$table->id();
$table->string('title');
$table->string('slug')->unique();
$table->string('summary');
$table->text('description');
$table->string('cover_image_path')->nullable();
$table->string('cover_image_alt')->nullable();
$table->integer('sort_order')->default(0)->index();
$table->boolean('is_featured')->default(false)->index();
$table->timestamp('published_at')->nullable()->index();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('services');
}
};

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('portfolio_cases', function (Blueprint $table): void {
$table->id();
$table->string('title');
$table->string('slug')->unique();
$table->string('summary');
$table->string('event_type');
$table->string('city')->nullable();
$table->string('venue')->nullable();
$table->date('event_date')->nullable();
$table->text('challenge');
$table->text('solution');
$table->text('result')->nullable();
$table->string('cover_image_path');
$table->string('cover_image_alt');
$table->boolean('is_featured')->default(false)->index();
$table->integer('sort_order')->default(0)->index();
$table->timestamp('published_at')->nullable()->index();
$table->string('meta_title')->nullable();
$table->text('meta_description')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('portfolio_cases');
}
};

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('portfolio_images', function (Blueprint $table): void {
$table->id();
$table->foreignId('portfolio_case_id')->constrained('portfolio_cases')->cascadeOnDelete();
$table->string('path');
$table->string('alt_text');
$table->string('caption')->nullable();
$table->integer('sort_order')->default(0);
$table->timestamps();
$table->index(['portfolio_case_id', 'sort_order']);
});
}
public function down(): void
{
Schema::dropIfExists('portfolio_images');
}
};

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('testimonials', function (Blueprint $table): void {
$table->id();
$table->text('quote');
$table->string('author_name');
$table->string('context')->nullable();
$table->string('photo_path')->nullable();
$table->string('photo_alt')->nullable();
$table->integer('sort_order')->default(0);
$table->boolean('is_featured')->default(false)->index();
$table->timestamp('published_at')->nullable()->index();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('testimonials');
}
};

Some files were not shown because too many files have changed in this diff Show More