Files
hub/app/Http/Requests/StoreBrandRequest.php
kelly 8a8f83cc0c feat: backfill product/brand descriptions from MySQL
- Remove min/max validation from tagline, description, long_description
- Add migration to import long_description from product_extras
- Restore 8 soft-deleted Nuvata products
- Update 13 brands with tagline/description/long_description from MySQL
2025-12-10 21:38:06 -07:00

64 lines
2.3 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreBrandRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
$business = $this->route('business');
return $this->user()->can('create', [\App\Models\Brand::class, $business]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
// Get valid voice and audience options from model
$validVoices = implode(',', array_keys(\App\Models\Brand::BRAND_VOICES));
$validAudiences = implode(',', array_keys(\App\Models\Brand::BRAND_AUDIENCES));
return [
'name' => 'required|string|max:255',
'tagline' => ['nullable', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:1000'],
'long_description' => ['nullable', 'string', 'max:5000'],
'brand_announcement' => ['nullable', 'string', 'max:500'],
'website_url' => 'nullable|string|max:255',
// SEO Fields
'seo_title' => ['nullable', 'string', 'max:70'],
'seo_description' => ['nullable', 'string', 'max:160'],
// Brand Voice and Audience (canonical sets)
'brand_voice' => "required|string|in:{$validVoices}",
'brand_audience' => "nullable|string|in:{$validAudiences}",
'address' => 'nullable|string|max:255',
'unit_number' => 'nullable|string|max:50',
'city' => 'nullable|string|max:100',
'state' => 'nullable|string|max:2',
'zip_code' => 'nullable|string|max:10',
'phone' => 'nullable|string|max:20',
'logo' => 'nullable|image|max:2048',
'banner' => 'nullable|image|max:4096',
'is_public' => 'boolean',
'is_featured' => 'boolean',
'is_active' => 'boolean',
'instagram_handle' => 'nullable|string|max:255',
'facebook_url' => 'nullable|url|max:255',
'twitter_handle' => 'nullable|string|max:255',
'youtube_url' => 'nullable|url|max:255',
];
}
}