22 lines
549 B
PHP
22 lines
549 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
class UpdateRecipe extends StoreRecipe
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
$rules = [
|
|
'slug' => 'required|unique:recipes,slug,' . $this->recipe->id . '|min:1|max:255',
|
|
];
|
|
if ($this->recipe->picture) {
|
|
$rules['picture'] = 'image|mimes:jpeg,png,jpg|max:2048|dimensions:width=683,height=434';
|
|
}
|
|
return array_merge(parent::rules(), $rules);
|
|
}
|
|
}
|