Pinterest Integration: - Add Pinterest OAuth controller and routes - Add PinterestPublisher service with support for pins, video pins, and carousels - Add PinterestPreview component with board selector and content type options - Add Pinterest content types enum (Pin, VideoPin, Carousel) - Add Pinterest to Platform enum with proper configuration - Support sandbox mode via PINTEREST_SANDBOX env variable - Pass platform-specific data (boards) through PlatformPreview Language Feature: - Add languages table with migration - Add Language model and seeder (en-US, pt-BR) - Add LanguageCombobox component for profile settings - Set default language (en-US) on user registration - Add language_id foreign key to users table UI Improvements: - Refactor PlatformPreview to support contentTypeOptions, meta, and platformData props - Move content type and board selectors into platform-specific preview components Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Concerns;
|
|
|
|
use App\Models\Language;
|
|
use App\Models\User;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
trait ProfileValidationRules
|
|
{
|
|
/**
|
|
* Get the validation rules used to validate user profiles.
|
|
*
|
|
* @return array<string, array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>>
|
|
*/
|
|
protected function profileRules(string|int|null $userId = null): array
|
|
{
|
|
return [
|
|
'name' => $this->nameRules(),
|
|
'email' => $this->emailRules($userId),
|
|
'language_id' => $this->languageRules(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules used to validate user language.
|
|
*
|
|
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
|
|
*/
|
|
protected function languageRules(): array
|
|
{
|
|
return ['required', Rule::exists(Language::class, 'id')];
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules used to validate user names.
|
|
*
|
|
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
|
|
*/
|
|
protected function nameRules(): array
|
|
{
|
|
return ['required', 'string', 'max:255'];
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules used to validate user emails.
|
|
*
|
|
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
|
|
*/
|
|
protected function emailRules(string|int|null $userId = null): array
|
|
{
|
|
return [
|
|
'required',
|
|
'string',
|
|
'email',
|
|
'max:255',
|
|
$userId === null
|
|
? Rule::unique(User::class)
|
|
: Rule::unique(User::class)->ignore($userId),
|
|
];
|
|
}
|
|
}
|