Compare commits

...

7 Commits

Author SHA1 Message Date
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
224 changed files with 23561 additions and 17 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

66
.env.example Normal file
View File

@@ -0,0 +1,66 @@
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
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
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

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

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

@@ -0,0 +1,233 @@
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
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
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
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
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
- name: Build application image
run: docker build -t amare-app:ci .
- name: Run browser tests against FrankenPHP container
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 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 \
-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
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
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
exit 0
fi
sleep 2
done
docker logs amare-health
exit 1

27
.gitignore vendored Normal file
View File

@@ -0,0 +1,27 @@
*.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

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.

62
Dockerfile Normal file
View File

@@ -0,0 +1,62 @@
# 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
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"]

107
README.md Normal file
View File

@@ -0,0 +1,107 @@
# 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`. Crie o symlink antes de servir arquivos localmente:
```bash
php artisan storage:link
```
Em produção, configure `FILESYSTEM_DISK=s3` no `.env`.
## 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

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,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,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

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,77 @@
<?php
declare(strict_types=1);
namespace App\Support;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Utilities\Get;
use Illuminate\Validation\Rules\File;
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(),
);
}
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 config('filesystems.default') === 's3' ? 's3' : 'public';
}
}

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,
];

122
composer.json Normal file
View File

@@ -0,0 +1,122 @@
{
"$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",
"laravel/framework": "^13.8",
"laravel/tinker": "^3.0"
},
"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"
],
"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
}

13170
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
config/app.php Normal file
View File

@@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', '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'),
/*
|--------------------------------------------------------------------------
| 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),
],
],
];

80
config/filesystems.php Normal file
View File

@@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

132
config/logging.php Normal file
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');
}
};

View File

@@ -0,0 +1,214 @@
<?php
declare(strict_types=1);
namespace Database\Seeders;
use App\Models\PortfolioCase;
use App\Models\PortfolioImage;
use App\Models\Service;
use App\Models\SiteSetting;
use App\Models\Testimonial;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
class ContentSeeder extends Seeder
{
private const SEED_TIMESTAMP = '2026-01-15 10:00:00';
public function run(): void
{
$this->seedSiteSettings();
$this->seedServices();
$this->seedPortfolioCases();
$this->seedTestimonials();
}
private function seedSiteSettings(): void
{
SiteSetting::query()->updateOrCreate([], [
'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 em Fortaleza.',
'hero_cta_label' => 'Solicitar orçamento',
'about_summary' => 'Assessoria boutique especializada em experiências memoráveis.',
'email' => 'contato@amare.local',
'phone' => '(85) 99999-9999',
'city' => 'Fortaleza, CE',
'social_links' => [
'instagram' => 'https://instagram.com/amare',
],
'default_meta_title' => 'Amare Assessoria de Eventos',
'default_meta_description' => 'Assessoria premium para casamentos e eventos corporativos.',
'default_og_image_path' => $this->copyFixture('og-default.jpg', 'content/og/og-default.jpg'),
'default_og_image_alt' => 'Identidade visual da Amare Assessoria de Eventos',
'analytics_enabled' => false,
'analytics_script' => null,
]);
}
private function seedServices(): void
{
$services = [
[
'title' => 'Casamentos',
'slug' => 'casamentos',
'summary' => 'Planejamento completo do grande dia.',
'description' => 'Do briefing ao último brinde, cuidamos de cada detalhe do casamento.',
'sort_order' => 1,
'is_featured' => true,
],
[
'title' => 'Eventos corporativos',
'slug' => 'eventos-corporativos',
'summary' => 'Experiências alinhadas à marca.',
'description' => 'Lançamentos, convenções e encontros corporativos com operação impecável.',
'sort_order' => 2,
'is_featured' => true,
],
[
'title' => 'Celebrações intimistas',
'slug' => 'celebracoes-intimistas',
'summary' => 'Encontros especiais em escala reduzida.',
'description' => 'Aniversários, mini weddings e jantares com curadoria editorial.',
'sort_order' => 3,
'is_featured' => false,
],
];
foreach ($services as $service) {
Service::query()->updateOrCreate(
['slug' => $service['slug']],
[
...$service,
'cover_image_path' => $this->copyFixture('service-cover.jpg', 'content/services/'.$service['slug'].'.jpg'),
'cover_image_alt' => 'Capa do serviço '.$service['title'],
'published_at' => Carbon::parse(self::SEED_TIMESTAMP),
],
);
}
}
private function seedPortfolioCases(): void
{
$cases = [
[
'title' => 'Casamento Ana e Lucas',
'slug' => 'casamento-ana-lucas',
'summary' => 'Cerimônia ao ar livre em Fortaleza.',
'event_type' => 'Casamento',
'city' => 'Fortaleza',
'venue' => 'Espaço Jardim Atlântico',
'event_date' => '2025-11-20',
'challenge' => 'Integrar cerimônia e recepção em áreas distintas.',
'solution' => 'Operação sincronizada com sinalização e timing detalhado.',
'result' => 'Experiência fluida para 180 convidados.',
'sort_order' => 1,
],
[
'title' => 'Lançamento Verano',
'slug' => 'lancamento-verano',
'summary' => 'Evento corporativo de lançamento de coleção.',
'event_type' => 'Corporativo',
'city' => 'Fortaleza',
'venue' => 'Centro de Convenções',
'event_date' => '2025-09-10',
'challenge' => 'Ativar marca em ambiente multiestação.',
'solution' => 'Fluxo de convidados e fornecedores com cronograma minuto a minuto.',
'result' => 'Alta percepção de marca e cobertura de imprensa.',
'sort_order' => 2,
],
[
'title' => 'Mini wedding Marina',
'slug' => 'mini-wedding-marina',
'summary' => 'Celebração intimista à beira-mar.',
'event_type' => 'Mini wedding',
'city' => 'Caucaia',
'venue' => 'Pousada da Praia',
'event_date' => '2025-06-02',
'challenge' => 'Clima e logística em área externa.',
'solution' => 'Plano B estruturado e fornecedores locais alinhados.',
'result' => 'Cerimônia emocionante com 40 convidados.',
'sort_order' => 3,
],
];
foreach ($cases as $caseData) {
$case = PortfolioCase::query()->updateOrCreate(
['slug' => $caseData['slug']],
[
...$caseData,
'cover_image_path' => $this->copyFixture('portfolio-cover.jpg', 'content/portfolio/'.$caseData['slug'].'-cover.jpg'),
'cover_image_alt' => 'Capa do caso '.$caseData['title'],
'is_featured' => true,
'published_at' => Carbon::parse(self::SEED_TIMESTAMP),
],
);
PortfolioImage::query()->where('portfolio_case_id', $case->id)->delete();
foreach ([1, 2] as $index) {
PortfolioImage::query()->create([
'portfolio_case_id' => $case->id,
'path' => $this->copyFixture('gallery.jpg', 'content/portfolio/'.$caseData['slug'].'-gallery-'.$index.'.jpg'),
'alt_text' => 'Galeria '.$caseData['title'].' '.$index,
'caption' => $index === 1 ? 'Detalhe da decoração' : null,
'sort_order' => $index,
]);
}
}
}
private function seedTestimonials(): void
{
$testimonials = [
[
'quote' => 'A Amare transformou nosso casamento em uma experiência inesquecível.',
'author_name' => 'Ana Souza',
'context' => 'Noiva',
'sort_order' => 1,
'is_featured' => true,
],
[
'quote' => 'Profissionalismo do início ao fim no lançamento da nossa coleção.',
'author_name' => 'Marcos Lima',
'context' => 'Diretor de marketing',
'sort_order' => 2,
'is_featured' => true,
],
[
'quote' => 'Cuidaram de cada detalhe com sensibilidade e precisão.',
'author_name' => 'Marina Costa',
'context' => 'Anfitriã',
'sort_order' => 3,
'is_featured' => false,
],
];
foreach ($testimonials as $testimonial) {
Testimonial::query()->updateOrCreate(
[
'author_name' => $testimonial['author_name'],
'quote' => $testimonial['quote'],
],
[
...$testimonial,
'photo_path' => $this->copyFixture('testimonial.jpg', 'content/testimonials/'.str($testimonial['author_name'])->slug().'.jpg'),
'photo_alt' => 'Foto de '.$testimonial['author_name'],
'published_at' => Carbon::parse(self::SEED_TIMESTAMP),
],
);
}
}
private function copyFixture(string $fixtureName, string $destination): string
{
$source = base_path('tests/fixtures/images/'.$fixtureName);
Storage::disk('public')->put($destination, File::get($source));
return $destination;
}
}

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Database\Seeders;
use App\Enums\UserRole;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
public function run(): void
{
User::query()->updateOrCreate(
['email' => 'admin@amare.local'],
[
'name' => 'Admin Local',
'password' => Hash::make('password'),
'role' => UserRole::Admin,
'is_active' => true,
],
);
User::query()->updateOrCreate(
['email' => 'assistant@amare.local'],
[
'name' => 'Assistente Local',
'password' => Hash::make('password'),
'role' => UserRole::Assistant,
'is_active' => true,
],
);
$this->call(ContentSeeder::class);
}
}

22
docker-compose.yml Normal file
View File

@@ -0,0 +1,22 @@
services:
postgres:
image: postgres:17
container_name: amare-postgres
restart: unless-stopped
ports:
- "${DB_PORT:-5432}:5432"
environment:
POSTGRES_DB: ${DB_DATABASE:-amare}
POSTGRES_USER: ${DB_USERNAME:-amare}
POSTGRES_PASSWORD: ${DB_PASSWORD:-secret}
volumes:
- amare_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-amare} -d ${DB_DATABASE:-amare}"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
volumes:
amare_postgres_data:

9
docker/Caddyfile Normal file
View File

@@ -0,0 +1,9 @@
{
frankenphp
}
:8000 {
root * /app/public
encode gzip zstd
php_server
}

11
docker/README.md Normal file
View File

@@ -0,0 +1,11 @@
## Processos de produção (SPEC §15.2)
Mesma imagem, comandos distintos:
| Processo | Comando |
|---|---|
| web | `frankenphp run --config /etc/caddy/Caddyfile` |
| queue | `php artisan queue:work --sleep=2 --tries=3` |
| scheduler | `php artisan schedule:work` |
FrankenPHP em **modo regular** (ADR-006). Worker mode proibido no MVP.

16
docker/entrypoint.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
set -e
if [ -z "$APP_KEY" ]; then
echo "APP_KEY is required" >&2
exit 1
fi
mkdir -p storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache
php artisan package:discover --ansi
php artisan config:cache
php artisan route:cache
php artisan view:cache
exec "$@"

16
docs/adr/README.md Normal file
View File

@@ -0,0 +1,16 @@
# Architecture Decision Records
Índice das ADRs aceitas definidas em [SPEC.md](../../SPEC.md) §21. Decisões não reabertas nesta fase.
| ADR | Decisão | Status |
|---|---|---|
| ADR-001 | Monólito modular Laravel, sem microserviços | Aceita |
| ADR-002 | Filament para área interna e Livewire/Blade para área pública | Aceita |
| ADR-003 | PostgreSQL como único banco transacional | Aceita |
| ADR-004 | Pagamentos somente manuais | Aceita |
| ADR-005 | Pest unifica unit, feature, browser e visual | Aceita |
| ADR-006 | FrankenPHP regular mode; worker mode adiado | Aceita |
| ADR-007 | Single-tenant; SaaS e portal do cliente adiados | Aceita |
| ADR-008 | Database queue; Redis adiado | Aceita |
| ADR-009 | Dinheiro em BRL armazenado como centavos inteiros | Aceita |
| ADR-010 | Home com estrutura fixa e CMS tipado, sem page builder | Aceita |

View File

@@ -0,0 +1,21 @@
# PHP Strict Types
## Convenção
Todo arquivo PHP **criado neste projeto** deve declarar strict types como primeira linha após `<?php`:
```php
<?php
declare(strict_types=1);
```
## Escopo
- Obrigatório em código de aplicação (`app/`), testes (`tests/`) e migrations criadas manualmente.
- Arquivos gerados por ferramentas (ex.: cache de views, vendor) ficam fora do escopo.
- Ao editar arquivo legado sem strict types, adicionar a declaração quando o arquivo for alterado de forma substantiva.
## Verificação
Testes de arquitetura Pest validam `App\Domain` com `toUseStrictTypes()` conforme SPEC §13.6.

View File

@@ -0,0 +1,2 @@
schema: spec-driven
created: 2026-07-29

View File

@@ -0,0 +1,97 @@
## Context
Fase 0 entregou Laravel 13, Filament 5 em `/admin`, design tokens, autenticação interna e pipeline CI. O repositório possui apenas home placeholder em [routes/web.php](../../routes/web.php). Esta change implementa a **metade CMS** da Fase 1 (SPEC §18): persistência e gestão Filament de conteúdo, sem rotas públicas.
Padrões existentes a seguir:
- Resources Filament com form/table separados ([app/Filament/Resources/Users/](../../app/Filament/Resources/Users/))
- Policies admin-only ([app/Policies/UserPolicy.php](../../app/Policies/UserPolicy.php))
- `declare(strict_types=1);` em todo PHP próprio
## Goals / Non-Goals
**Goals:**
- Assessora admin gerencia settings, serviços, portfólio e depoimentos no Filament.
- Dados persistidos conforme SPEC §8.2, prontos para consumo pela change `build-public-site`.
- Feature tests locais em PostgreSQL (jsonb, constraints reais).
- Seed determinístico parcial para desenvolvimento e testes futuros.
**Non-Goals:**
- Rotas públicas, home, SEO, sitemap, snapshots visuais, briefing.
- Actions de publicação com auditoria (`PublishPortfolioCase` etc.) — adiadas até Fase 5.
- Variantes responsivas de imagem, page builder, categorias dinâmicas.
## Decisions
### 1. Publicação via `published_at` único
**Decisão:** `published_at` nullable timestamp é a única fonte de verdade. Scope `published()` no model (`whereNotNull('published_at')`). Sem coluna `is_published`.
**Alternativa rejeitada:** boolean `is_published` + `published_at` — viola SPEC §1.1 (não persistir status derivável).
### 2. Mídia em disco `public` local, S3 em produção
**Decisão:** uploads de capa/galeria/foto usam disco Laravel configurável via `FILESYSTEM_DISK`. Local: `public` + `php artisan storage:link`. Produção: `s3`. Path gerado com UUID/hash, nunca nome original.
**Alternativa rejeitada:** blobs no PostgreSQL — proibido por SPEC §6.4.
### 3. Validação de mídia centralizada
**Decisão:** classe em `app/Support/` (ex.: `PublicImageUploadRules`) com allowlist MIME (`image/jpeg`, `image/png`, `image/webp`), extensões correspondentes, limite 10 MB, alt text obrigatório quando imagem presente. Reutilizada nos Resources Filament.
### 4. Sem Actions de domínio nesta fase
**Decisão:** Filament Resources salvam diretamente via Eloquent. Actions (`PublishPortfolioCase`, `UnpublishPortfolioCase`) só serão criadas quando auditoria (Fase 5) exigir efeito colateral transacional.
**Rationale:** SPEC §9.5 — não criar Action para CRUD sem regra adicional.
### 5. Auditoria de publicação adiada
**Decisão:** publicar/despublicar **não** grava `audit_logs` nesta change.
**Desvio documentado:** ADM-02 lista publicação como auditável, mas tabela `audit_logs` é Fase 5. Retomar em change de hardening.
### 6. Autorização admin-only para CMS
**Decisão:** Policies espelham `UserPolicy``$user->isAdmin()` para view/create/update/delete em conteúdo do site. Assistant recebe 403 em todos os Resources de conteúdo.
**Referência:** WEB-02 — "admin pode gerenciar; assistant não pode".
### 7. Site settings como singleton Filament Page
**Decisão:** model `SiteSetting` com método `instance()` (primeiro registro ou create default). Filament `ManageSiteSettings` page (não Resource de lista) — evita CRUD genérico de chave/valor (SPEC §WEB-06).
### 8. Slug automático a partir do título
**Decisão:** slug gerado no model (observer ou mutator) com `Str::slug()`, unique constraint no banco. Admin pode editar slug no form.
### 9. Navegação Filament
**Decisão:** grupo `Conteúdo do site` com sort order conforme SPEC §5.2:
1. Configurações (singleton page)
2. Serviços
3. Portfólio
4. Depoimentos
## Risks / Trade-offs
| Risco | Mitigação |
|---|---|
| Uploads locais sem S3 em dev | `Storage::fake()` nos testes; documentar `storage:link` no README |
| Galeria ordenada complexa no Filament | Relation manager com `sort_order` e reorderable |
| jsonb `social_links` difere SQLite | phpunit.xml já migrado para PostgreSQL |
| Conteúdo criado sem rotas públicas | seed + testes Filament validam CMS; rotas vêm em `build-public-site` |
| Auditoria ausente em publicação | desvio explícito; retomar Fase 5 |
## Migration Plan
1. Rodar migrations em ordem: `site_settings``services``portfolio_cases` + `portfolio_images``testimonials`.
2. Executar seed de conteúdo após migrations.
3. Sem rollback de dados em produção (greenfield); `migrate:rollback` suportado em dev.
## Open Questions
- Nenhuma bloqueante. Fontes tipográficas finais da home ficam para `build-public-site`.

View File

@@ -0,0 +1,42 @@
## Why
A Fase 0 — Fundação está concluída e arquivada; o próximo passo do MVP é permitir que a assessora gerencie conteúdo do site no Filament antes de expor rotas públicas. Sem modelos, migrations e Resources internos para configurações, serviços, portfólio e depoimentos, a Fase 1 não pode avançar e o site permanece estático.
## What Changes
- Criar tabelas e models conforme SPEC §8.2: `site_settings`, `services`, `portfolio_cases`, `portfolio_images`, `testimonials`.
- Implementar CMS Filament no grupo **Conteúdo do site** (SPEC §5.2) para WEB-02, WEB-03, WEB-04 e WEB-06.
- Introduzir regras compartilhadas de upload de mídia pública (allowlist MIME, limite de tamanho, path aleatório, alt text obrigatório).
- Policies admin-only para conteúdo do site; assistant não gerencia CMS (WEB-02).
- Factories e seed parcial de demonstração (3 serviços, 3 casos, 3 depoimentos, settings).
- Alinhar `phpunit.xml` para feature tests locais em PostgreSQL (delta de `quality-gates`).
## Non-Goals
Conforme [SPEC.md §4.2](../../SPEC.md) e a divisão da Fase 1:
- Rotas públicas, home editorial (WEB-01), páginas institucionais (WEB-07), briefing (WEB-05).
- SEO, sitemap, robots, snapshots visuais e testes de acessibilidade do site público.
- Page builder, CRUD de categorias, auditoria de publicação (`audit_logs` — Fase 5).
- Variantes responsivas de imagem (adiadas para change `build-public-site`).
## Capabilities
### New Capabilities
- `site-settings`: singleton tipado de configurações globais do site (WEB-06).
- `service-catalog`: CRUD de serviços publicáveis com slug único (WEB-02).
- `portfolio-cases`: casos de portfólio com galeria ordenada (WEB-03).
- `testimonials`: depoimentos publicáveis (WEB-04).
- `content-media`: validação e armazenamento compartilhado de imagens públicas (SPEC §6.4, §12.4).
### Modified Capabilities
- `quality-gates`: feature tests locais MUST usar PostgreSQL, alinhados ao CI (SPEC §14.2, §20).
## Impact
- **Cria**: migrations, models, factories, Policies, Filament Resources/Pages em `app/Filament/`, seeders, testes feature em `tests/Feature/Marketing/`.
- **Altera**: `phpunit.xml`, `DatabaseSeeder`, navegação do painel Filament.
- **Depende de**: specs arquivadas da fundação (`internal-authentication`, `design-tokens`, `quality-gates`).
- **Sem impacto** em rotas públicas existentes além do placeholder `/`.

View File

@@ -0,0 +1,32 @@
## ADDED Requirements
### Requirement: Public content images are validated and stored securely
The system SHALL validate public content uploads (service covers, portfolio covers/gallery, testimonial photos, site OG image) per SPEC §6.4 and §12.4. Validation MUST enforce MIME allowlist (jpeg, png, webp), matching extensions, maximum size of 10 MB, and mandatory alt text when an image is uploaded.
#### Scenario: Invalid MIME is rejected
- **WHEN** an admin uploads a file with disallowed MIME type
- **THEN** validation MUST fail with a pt-BR error message
#### Scenario: Oversized file is rejected
- **WHEN** an admin uploads an image exceeding 10 MB
- **THEN** validation MUST fail
#### Scenario: Storage path is not derived from original filename
- **WHEN** an image is stored
- **THEN** the physical path MUST be generated (UUID/hash based)
- **AND** MUST NOT use the original upload filename as the storage key
#### Scenario: Alt text required with image
- **WHEN** an admin uploads a cover or gallery image without alt text
- **THEN** validation MUST fail
#### Scenario: Images are not stored in PostgreSQL
- **WHEN** content with images is persisted
- **THEN** only the filesystem path MUST be stored in the database
- **AND** binary image data MUST NOT be written to PostgreSQL columns

View File

@@ -0,0 +1,31 @@
## ADDED Requirements
### Requirement: Portfolio cases support editorial content and ordered gallery
The system SHALL allow admins to manage portfolio cases (SPEC WEB-03) with title, unique slug, summary, event type, optional city/venue/event date, challenge, solution, optional result, cover image with alt text, featured flag, sort order, `published_at`, and optional SEO meta fields. Each case MUST support an ordered gallery via `portfolio_images` (path, alt text, optional caption, sort order).
#### Scenario: Draft case is not publicly visible
- **WHEN** a portfolio case has `published_at` null
- **THEN** the `published()` scope MUST exclude it
#### Scenario: Published case meets acceptance criteria
- **WHEN** an admin fills required fields and sets `published_at`
- **THEN** the case MUST be included in the `published()` scope
- **AND** cover and gallery images MUST have alt text when present
#### Scenario: Gallery images maintain order
- **WHEN** an admin reorders gallery images in Filament
- **THEN** `sort_order` MUST reflect the chosen order per `portfolio_case_id`
#### Scenario: Assistant cannot manage portfolio
- **WHEN** an assistant attempts to access portfolio cases
- **THEN** access MUST be denied with HTTP 403
#### Scenario: Cascade delete removes gallery images
- **WHEN** a portfolio case is deleted
- **THEN** associated `portfolio_images` records MUST be removed (FK cascade)

View File

@@ -0,0 +1,16 @@
## ADDED Requirements
### Requirement: Local feature tests use PostgreSQL
The system SHALL configure `phpunit.xml` so that the Feature test suite uses PostgreSQL with the same connection parameters as CI (`DB_CONNECTION=pgsql`, host, port, database `amare_test`, credentials). Local feature tests MUST NOT default to SQLite `:memory:`.
#### Scenario: Developer runs feature tests locally
- **WHEN** a developer runs `composer test:feature` with PostgreSQL available
- **THEN** tests MUST execute against PostgreSQL
- **AND** MUST NOT silently fall back to SQLite
#### Scenario: Feature tests exercise PostgreSQL-specific types
- **WHEN** feature tests persist records with jsonb columns (e.g., `social_links`)
- **THEN** migrations and constraints MUST be validated against PostgreSQL semantics

View File

@@ -0,0 +1,30 @@
## ADDED Requirements
### Requirement: Services are managed in Filament with publication control
The system SHALL allow admins to create, update, and delete services (SPEC WEB-02). Each service MUST have title, unique slug, summary, description, optional cover image with alt text, sort order, featured flag, and `published_at`.
#### Scenario: Unpublished service is not publicly visible
- **WHEN** a service has `published_at` null
- **THEN** the `published()` scope MUST exclude it from public queries
#### Scenario: Published service is queryable
- **WHEN** an admin sets `published_at` on a service with required fields
- **THEN** the service MUST be included in the `published()` scope
#### Scenario: Slug uniqueness is enforced
- **WHEN** an admin attempts to save two services with the same slug
- **THEN** validation or database constraint MUST reject the duplicate
#### Scenario: Assistant cannot manage services
- **WHEN** an assistant attempts to access the services Resource
- **THEN** access MUST be denied with HTTP 403
#### Scenario: Delete requires confirmation
- **WHEN** an admin deletes a service in Filament
- **THEN** the UI MUST require explicit confirmation before deletion

View File

@@ -0,0 +1,28 @@
## ADDED Requirements
### Requirement: Site settings singleton is manageable by admin only
The system SHALL persist site-wide settings in a `site_settings` table as a typed singleton (SPEC WEB-06, §8.2). Fields MUST include brand name, hero copy (eyebrow, title, subtitle, CTA label), about summary, contact email/phone/city, social links (jsonb), default meta title/description, default OG image path and alt text, and optional analytics fields disabled by default.
#### Scenario: Admin updates site settings
- **WHEN** an admin saves the site settings form in Filament
- **THEN** the singleton record is updated
- **AND** labels and validation messages are in pt-BR
#### Scenario: Assistant cannot access site settings
- **WHEN** an assistant navigates to site settings in Filament
- **THEN** access MUST be denied with HTTP 403
#### Scenario: Default OG image requires alt text
- **WHEN** an admin uploads a default OG image without alt text
- **THEN** validation MUST fail with a pt-BR error message
- **AND** alt text MUST remain optional when no default OG image is present
#### Scenario: Singleton avoids generic key-value store
- **WHEN** site settings are stored
- **THEN** the system MUST use typed columns on `site_settings`
- **AND** MUST NOT introduce a generic key/value configuration table

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