How can I validate something else after the regular validation in a form-request? I need to verify that a folder does exists or not based on the name given in a input.
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateFolder extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return (auth()->check() && auth()->user()->can('create folders'));
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|between:1,64|string'
];
}
}
I want to use the same name when I validate that the folder exists or not after the regular validation. The docs didn't specify anything useful as I could see.
public/files/