Updated the UpdateProductRequest and UpdateRecipeRequest to use built-in validation rules for file uploads, removing custom validation methods for pictures and PDFs. This change streamlines the validation process and improves code readability. refactor(helper): remove unused FileStorageHelper Deleted the FileStorageHelper class as it was no longer needed, simplifying the codebase. refactor(toolbox): clean up ToolboxHelper methods Removed unused methods and simplified existing ones in ToolboxHelper to enhance maintainability. feat(models): add translation search method to Product and Recipe Added a new method `whereTranslationLike` to both Product and Recipe models to facilitate searching translations. chore(config): add storage service prefix configuration Introduced a new configuration option for storage service prefix to allow customization of media paths. fix(validation): add file existence validation message Added a French translation for the file existence validation message to improve user feedback. feat(routes): add media route for file access Implemented a new route for accessing media files through a MediaController, enhancing file management capabilities.
28 lines
748 B
PHP
28 lines
748 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Back\Recipes;
|
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class UpdateRecipeRequest extends StoreRecipeRequest
|
|
{
|
|
public function rules(): array
|
|
{
|
|
return array_merge(parent::rules(), [
|
|
'picture' => [
|
|
'required',
|
|
$this->hasFile('picture')
|
|
? Rule::imageFile()
|
|
->max(self::MAX_FILE_SIZE_KB)
|
|
->dimensions(
|
|
Rule::dimensions()
|
|
->width(static::PICTURE_WIDTH)
|
|
->height(static::PICTURE_HEIGHT)
|
|
)
|
|
: 'string',
|
|
],
|
|
]);
|
|
}
|
|
}
|