/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { Validator::extend('pretty_url', function ($attribute, $value, $parameters) { $prettyUrl = PrettyUrl::where("url", $value)->get()->first(); $isMyUrl = $prettyUrl ? $prettyUrl->prettyurlable == Auth::user()->entidadeAtiva : true; return $prettyUrl ? $isMyUrl : true; }); return ['nome' => "string|required|min:2", 'descricao' => "string|required|min:2", 'horario_funcionamento' => "string|required|min:2", 'url' => "required|alpha_dash|min:2|pretty_url", 'logradouro' => "string|required|min:2", 'cep' => "required|min:2", 'bairro' => "string|required|min:2", 'complemento' => "string|min:2", 'email_contato' => "email", 'telefone_contato' => "min:8", 'cidade_id' => "required|exists:cidades,id", 'categoria_ong_id' => "required|exists:categoria_ongs,id"]; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { Validator::extend('pretty_url', function ($attribute, $value, $parameters) { $prettyUrl = PrettyUrl::where("url", $value)->get()->first(); $isMyUrl = $prettyUrl ? $prettyUrl->prettyurlable == Auth::user()->entidadeAtiva : true; return $prettyUrl ? $isMyUrl : true; }); return ["nome" => "required|min:4", "apelido" => "required|min:2", "url" => "required|alpha_dash|min:2|pretty_url"]; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { Validator::extend('pretty_url', function ($attribute, $value, $parameters) { $prettyUrl = PrettyUrl::where("url", $value)->get()->first(); $isMyUrl = $prettyUrl ? $prettyUrl->prettyurlable == Auth::user()->entidadeAtiva : true; return $prettyUrl ? $isMyUrl : true; }); return ["foto_upload" => 'mimes:png,jpg', "nome" => 'date_format:"d/m/Y"', "descricao" => 'alpha|min:3']; }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { Validator::extend('pretty_url', function ($attribute, $value, $parameters) { $prettyUrl = PrettyUrl::where("url", $value)->get()->first(); $isMyUrl = $prettyUrl ? $prettyUrl->prettyurlable == Auth::user()->entidadeAtiva : true; return $prettyUrl ? $isMyUrl : true; }); return ["apelido" => "required|min:2", "url" => "required|string|min:2|pretty_url", "aniversario" => 'required|date_format:"d/m/Y"', "descricao_curta" => 'string', "descricao_longa" => 'string', "cidade_atual" => 'string|min:3']; }