public function boot() { $this->loadViewsFrom(realpath(__DIR__ . '/../views'), 'maikblog'); $this->publishes([realpath(__DIR__ . '/../views') => base_path('resources/views/vendor/maikblog')]); $this->setupRoutes($this->app->router); // this for conig $this->publishes([__DIR__ . '/config/maikblog.php' => config_path('maikblog.php')], 'config'); //this for migrations $this->publishes([__DIR__ . '/database/migrations/' => database_path('migrations')], 'migrations'); //this for css and js $this->publishes([realpath(__DIR__ . '/../assets') => public_path('maiklez/maikblog')], 'public'); \Validator::extend('tag_rule', function ($attribute, $value, $parameters) { $tags = explode(',', $value); // remove empty items from array $tags = array_filter($tags); // trim all the items in array $tags = array_map('trim', $tags); \Debugbar::info($tags); foreach ($tags as $tag) { if ($tag === "") { return false; } } return true; }); \Validator::replacer('tag_rule', function ($message, $attribute, $rule, $parameters) { return str_replace("no white spaces are allow"); }); }
public function validate($input_arr = array()) { $this->validate_errors = array(); //Log::info('in database'.print_r($input_arr, true)); Validator::extend('in_database', function ($attribute, $value, $parameters) use($input_arr) { //Log::info('in database'.print_r($parameters, true)); if ($attribute == 'host') { return Check::where('check_id', '!=', isset($input_arr['check_id']) && ($c = $input_arr['check_id']) ? $c : 0)->where('user_id', $input_arr['user_id'])->where('type', $input_arr['type'])->where('host', $value)->count() == 0; } else { return Check::where('check_id', '!=', isset($input_arr['check_id']) && ($c = $input_arr['check_id']) ? $c : 0)->where('user_id', $input_arr['user_id'])->where('type', $input_arr['type'])->where('url', $input_arr['type'] == 'https' ? str_replace('http://', 'https://', $value) : $value)->count() == 0; } }); $rules = $this->rules[$this->use_rules]; if (isset($input_arr['edit_options']) && $input_arr['edit_options']) { $rules['options'] = 'json_decode'; } else { $rules['phrases'] = 'json_encode'; $rules['post_body'] = 'json_encode'; } $attributes = array('url' => $input_arr['url'], 'type' => $input_arr['type'], 'action' => $input_arr['action']); $validator = Validator::make($input_arr, $rules); //$validator->setAttributeNames($attributes); if ($validator->fails()) { $this->set_custom_attributes($validator, $attributes); //$this->validate_errors = $validator->messages()->all(); return false; } else { return true; } }
/** * Bootstrap any application services. * * @return void */ public function boot() { // \Validator::extend('current_password', function ($attribute, $value, $parameters, $validator) { return \Hash::check($value, \Auth::user()->password); }); }
/** * Process video upload * * @param \Illuminate\Http\Request $request The form with the needed data * @return \Illuminate\Http\RedirectResponse */ public function process(Request $request) { //validation rules $rules = ['title' => 'required', 'category_list' => 'required', 'user_id' => 'required', 'video' => 'isneededvideo']; //validation messages $msgs = ['title.required' => 'A cím kitöltése kötelező!', 'category_list.required' => 'A kategória kiválasztása kötelező!', 'user_id.required' => 'A szerző kiválasztása kötelező!', 'video.required' => 'Videó nélkül nincs mit feltölteni!', 'isneededvideo' => 'A videónak mp4 vagy webm formátumúnak kell lennie!']; \Validator::extend('isneededvideo', function ($attr, $value, $params) { return $value->getMimeType() == 'video/mp4' || $value->getMimeType() == 'video/webm'; }); $validator = \Validator::make($request->all(), $rules, $msgs); if ($validator->fails()) { return redirect()->back()->withErrors($validator->errors())->withInput($request->all()); } //ease up coding with some shortcuts $file = $request->file('video'); $extension = strtolower($file->getClientOriginalExtension()); $video = \App\Models\Video::create($request->except('video', 'category_list')); //set video filename $video->video = $video->getKey() . '.' . $extension; //move video file $file->move(public_path() . '/videos/', $video->video); //save object $video->save(); //sync pivot $video->categories()->sync(array_filter($request->input('category_list'))); //do the capture $this->capture($video); return redirect('/'); }
public function boot() { \Validator::extend('alpha_spaces', function ($attribute, $value, $parameters) { return preg_match('/^([-a-z - _-ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîï ðñòóôõöùúûüýøþÿÐdŒ-\\s])+$/i', $value); }); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { \Validator::extend('badword', function ($attribute, $value, $parameters) { return !BadWord::where('word', 'LIKE', "%{$value}%")->exists(); }); return ['receiver' => 'badword', 'message' => 'badword']; }
public function post() { // Only permit logged in users to comment if (Auth::check()) { // Add a rule to verify the particular item exists Validator::extend('itemExists', function ($attribute, $value, $parameters) { $type = ucfirst(Input::get('type')); $item = $type::find($value); return $item; }); // Validate the data $validator = Validator::make(Input::all(), array('id' => 'itemExists', 'type' => 'in:doctor,companion,enemy,episode', 'title' => 'required|min:5', 'email' => 'required|email', 'content' => 'required'), array('required' => 'You forgot to include the :attribute on your comment!', 'itemExists' => 'If you can see this, the universe is broken because that ' . Input::get('type') . ' does not exist.')); if ($validator->fails()) { return Redirect::to(URL::previous() . '#comments')->withErrors($validator)->withInput(); } else { $comment = new Comment(); $comment->user_id = Auth::id(); $comment->item_id = Input::get('id'); $comment->item_type = Input::get('type'); $comment->title = Input::get('title'); $comment->content = Input::get('content'); $comment->save(); return Redirect::to(URL::previous() . '#comments')->with('message', 'Comment posted'); } } }
/** * Handles both creating new client and updating an existing client. * * @return Response */ public function save() { ## Form Validation ## Validator::extend('phone', function ($attribute, $value, $parameters) { if (preg_match('/^[0-9]+$/', $value)) { return true; } else { return false; } }); ## Define Rules ## $rules = array('site_name' => 'required', 'contact_person' => 'required', 'contact_type' => 'required', 'phone_number' => 'required|phone', 'cell_number' => 'phone', 'address' => 'required', 'town' => 'required', 'province' => 'required', 'postal_code' => 'required', 'office_distance' => 'required|numeric|min:0', 'bill_rate' => 'required|numeric|min:0'); ## Define Error Message ## $message = array('site_name.required' => Lang::get('clients.site_require'), 'contact_person.required' => Lang::get('clients.contact_require'), 'contact_type.required' => Lang::get('clients.contact_type_require'), 'phone_number.required' => Lang::get('clients.phone_require'), 'address.required' => Lang::get('clients.address_require'), 'town.required' => Lang::get('clients.town_require'), 'province.required' => Lang::get('clients.province_require'), 'postal_code.required' => Lang::get('clients.postal_code_require'), 'office_distance.required' => Lang::get('clients.office_distance_require'), 'phone_number.phone' => Lang::get('clients.phone_invalid'), 'cell_number.phone' => Lang::get('clients.cell_number_invalid')); $validator = Validator::make(Input::all(), $rules, $message); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } ##------to create /update client-------## $result = FleetClient::saveClient(); if ($result == true) { return Redirect::to('fleets/clients')->with('success', Lang::get('clients.client_saved')); } else { return Redirect::back()->with('error', $result); } }
public function postSettings() { // Hex RGB Custom Validator Validator::extend('hex', function ($attribute, $value, $parameters) { return preg_match("/^\\#[0-9A-Fa-f]{6}\$/", $value); }); // Validation Rules $rules = ['nc-color' => 'required|hex', 'tr-color' => 'required|hex', 'vs-color' => 'required|hex', 'time-format' => 'required|in:12,24']; // Validation $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::back(); } // Save Hex and Dark Hex colors to Session foreach (['nc', 'tr', 'vs'] as $faction) { $color = strtolower(Input::get("{$faction}-color")); // Chosen color Session::put("faction-colors.{$faction}.default", $color); // Color darkened by 50% Session::put("faction-colors.{$faction}.dark", $this->adjustColorLightenDarken($color, 50)); // Outline color if ($color == Config::get("ps2maps.faction-colors.{$faction}.default")) { // If color is default color, use white outline $outline = "#FFF"; } else { // Otherwise use calculated outline color $outline = $this->closerToBlackOrWhite(Input::get("{$faction}-color")) == "#FFF" ? "#000" : "#FFF"; } Session::put("faction-colors.{$faction}.outline", $outline); } // Save time format to session Session::put('time-format', Input::get('time-format')); return Redirect::back()->with('message', 'Settings Saved'); }
public function __construct() { Validator::extend('file', function ($attribute, $value, $parameters) { $permitidos = ['application/msword' => 'doc', 'application/pdf' => 'pdf', 'application/rtf' => 'rtf', 'application/vnd.kde.kspread' => 'ksp', 'application/vnd.kde.kword' => 'kwd', 'application/vnd.ms-excel' => 'xls', 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', 'application/vnd.ms-word.document.macroenabled.12' => 'docm', 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', 'application/vnd.ms-xpsdocument' => 'xps', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', 'application/xml' => 'xml', 'image/bmp' => 'bmp', 'image/x-ms-bmp' => 'bmp', 'image/jpeg' => 'jpeg', 'image/jpg' => 'jpg', 'image/png' => 'png']; return in_array($value, $permitidos); }); }
public function validator(array $data) { \Validator::extend('passcheck', function () { $value = \Request::input('old_password'); return \Hash::check($value, \Auth::user()->password); }); return \Validator::make($data, ['password' => 'required|confirmed|min:6', 'old_password' => 'required|passcheck'], ['old_password.required' => 'Паролата е задължителна.', 'old_password.passcheck' => 'Грешна парола.', 'password.required' => 'Паролата е задължителна.', 'password.confirmed' => 'Потвърдената парола е грешна.', 'password.min' => 'Минимална дължина на паролата 6 символа.']); }
/** * Bootstrap any application services. * * @return void */ public function boot() { // Custom validation methods \Validator::extend('is_image', function ($attribute, $value, $parameters, $validator) { $imageMimes = ['image/png', 'image/bmp', 'image/gif', 'image/jpeg', 'image/jpg', 'image/tiff', 'image/webp']; return in_array($value->getMimeType(), $imageMimes); }); }
public function __construct() { Validator::extend('skinmimes', function ($attribute, $value, $parameters) { $allowed = array('audio/mpeg', 'image/jpeg', 'application/ogg', 'audio/wave', 'audio/aiff', 'image/png', 'text/plain'); $mime = new MimeReader($value->getRealPath()); return in_array($mime->get_type(), $allowed); }); }
public function __construct() { parent::__construct(); \Validator::extend('seats_capacity', function ($attribute, $value, $parameters) { // dd($this->attributes); return $this->attributes['seats_economy'] * 1 + $this->attributes['seats_business'] * 2 + $this->attributes['seats_firstclass'] * 4 <= $parameters[0]; //Kupowany samolot nie może mieć więcej foteli niż pojemność kadłuba }); }
/** * Bootstrap the application services. * * @return void */ public function boot() { \Validator::extend('sets', function ($attribute, $value, $parameters) { $as = explode(',', $value); return empty(array_diff($as, $parameters)); }); $this->loadTranslationsFrom(__DIR__ . '/../lang', 'tsotsi'); $this->publishes([__DIR__ . '/../../lang' => base_path('resources/lang/vendor/tsotsi')]); }
/** * Boot do Provider. */ public function boot() { parent::boot(); $trans = app('translator'); \Validator::extend('id', '\\Bugotech\\Validation\\Validators@id', $trans->get('O :attribute deve ser um ID (Ex.: ABC999...).')); \Validator::extend('route', '\\Bugotech\\Validation\\Validators@route', $trans->get('O :attribute não é uma rota válida.')); \Validator::extend('domain', '\\Bugotech\\Validation\\Validators@domain', $trans->get('O :attribute esta inválido.')); \Validator::extend('checkpass', '\\Bugotech\\Validation\\Validators@checkpass', $trans->get('A senha antiga não confere.')); }
/** * Bootstrap any application services. * * @return void */ public function boot() { User::created(function ($user) { event(new UserCreateEvent($user)); }); \Validator::extend('html_color', function ($attribute, $value, $parameters, $validator) { return preg_match('/^#[a-f0-9]{6}$/i', $value); }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { \Validator::extend('title', function ($attribute, $value, $parameters, $validator) { return is_string($value) && preg_match('/^[\\pL0-9 \\pM]+$/u', $value); }); \Validator::replacer('title', function ($message, $attribute, $rule, $parameters) { return 'only acceptable letters, numbers and spaces'; }); }
/** * Boot do Provider. */ public function boot() { parent::boot(); $trans = app('translator'); \Validator::extend('id', '\\Bugotech\\Validation\\Validators@id', $trans->get('validation.id')); \Validator::extend('route', '\\Bugotech\\Validation\\Validators@route', $trans->get('validation.route')); \Validator::extend('domain', '\\Bugotech\\Validation\\Validators@domain', $trans->get('validation.domain')); \Validator::extend('database', '\\Bugotech\\Validation\\Validators@database', $trans->get('validation.database')); \Validator::extend('checkpass', '\\Bugotech\\Validation\\Validators@checkpass', $trans->get('validation.checkpass')); }
public function boot() { $this->mergeConfigFrom(__DIR__ . '/config/nondictionary.php', 'nondictionary'); $this->loadTranslationsFrom(__DIR__ . '/lang', 'restrict-wordlist-passwords'); $this->publishes([__DIR__ . '/lang' => resource_path('lang/vendor/restrict-wordlist-passwords')], 'lang'); \Validator::extend('non_dictionary', function ($attribute, $value, $parameters, $validator) { $dictionary = file(\Config::get('nondictionary.file')); $dictionary = array_map('trim', $dictionary); return !in_array($value, $dictionary); }, trans('restrict-wordlist-passwords::validation.non_dictionary')); }
protected function beforeValidation() { \Validator::extend('max_tags', function ($attribute, $tagIds, $params) { $maxCount = $params[0]; $tagRepo = \App::make('Lio\\Tags\\TagRepository'); $tags = $tagRepo->getTagsByIds($tagIds); if ($tags->count() > $maxCount) { return false; } return true; }); }
public function boot() { \Validator::extend('max_tags', function ($attribute, $tagIds, $params) { $maxCount = $params[0]; $tagRepo = App::make('Lio\\Tags\\TagRepository'); $tags = $tagRepo->getTagsByIds($tagIds); if (is_null($tags) || $tags->count() > $maxCount) { return false; } return true; }); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $this->publishes([$this->getConfigPath() => config_path('ipboard.php')]); \Validator::extend("is_csv_numeric", function ($attribute, $value, $parameters, $validator) { return preg_match("/^[0-9,]+\$/i", $value); }); \Validator::extend("is_csv_alpha", function ($attribute, $value, $parameters, $validator) { return preg_match("/^[A-Z,]+\$/i", $value); }); \Validator::extend("is_csv_alphanumeric", function ($attribute, $value, $parameters, $validator) { return preg_match("/^[0-9A-Z,]+\$/i", $value); }); }
/** * Bootstrap any application services. * * @return void */ public function boot() { \Validator::extend('alpha_spacex', function ($attribute, $value) { // exi('xxx'); // return preg_match('/^[\pL\s]+$/u', $value); return preg_match('/^[-a-zA-Z0-9 .,"]+$/', $value) == 1 ? true : false; // return true; }); \Validator::extend('isDateId', function ($attribute, $value) { // return !isDateId($value) ; return isDateId($value); }); }
public function test_user_cannot_add_the_same_number_twice() { Validator::extend('valid_phone', function ($attribute, $value, $parameters, $validator) { // Skip validation because we can't validate a phone number on test creds return true; }); $user = factory(User::class)->create(); $this->be($user); $number = '7345678309'; $this->post(route('numbers.store'), ['name' => 'Sally', 'number' => $number]); $this->post(route('numbers.store'), ['name' => 'Schmally', 'number' => $number]); $numbers = $user->phoneNumbers()->where(['number' => $number])->get(); $this->assertEquals(1, $numbers->count()); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { \Validator::extend('composite_unique', function ($attribute, $value, $parameters, $validator) { // remove first parameter and assume it is the table name $table = array_shift($parameters); // start building the conditions $con1 = [$attribute => $value]; $con2 = [$parameters[0] => $parameters[1]]; // query the table with all the conditions $result = \DB::table($table)->select(\DB::raw(1))->where($con1)->where($con2)->count(); return empty($result); // edited here }, 'The :attribute has already been taken.'); return ['catalog_no' => 'required|composite_unique:prospectus,curriculum,' . $this->request->get('curriculum')]; }
function postPassword() { Validator::extend('passcheck', function ($attribute, $value, $parameters) { return Hash::check($value, Auth::user()->password); }); $messages = array('passcheck' => 'Your old password was incorrect'); $input = Input::all(); $rules = array('old_pass' => 'required|passcheck', 'new_pass' => 'required|min:5', 're_new_pass' => 'required|min:5|same:new_pass'); $valid = Validator::make($input, $rules, $messages); if ($valid->passes()) { $this->model->password($input); return Redirect::to('zadmin/' . $this->ctrl . '')->with('success', $this->title . ' sucessfully changed'); } return Redirect::to('zadmin/' . $this->ctrl . '')->with('failed', 'Failed to change ' . $this->title . ', Because your old password is incorresct '); }
/** * Bootstrap any application services. * * @return void */ public function boot() { // \Validator::extend('mobile', function ($attribute, $value, $parameters) { return mobileCheck($value); }); \Validator::extend('identity', function ($attribute, $value, $parameters) { return identityCardCheck($value); }); \App::environment('local') && \DB::enableQueryLog(); if (\App::environment('local') && file_exists(app_path() . '/localHelper.php')) { include app_path('localHelper.php'); } \DB::listen(function ($sql, $bindings, $time) { }); }
public function process_form() { if (!count($_POST)) { return View::make('includes/template')->with('template', 'form'); } else { Validator::extend('day_of_month', function ($attribute, $value, $parameters) { $month = intval($_POST['dob_month']); $year = intval($_POST['dob_year']) ? intval($_POST['dob_year']) : 2013; if (!$month) { return false; } $total_days = date("t", mktime(1, 1, 1, $month, 1, $year)); return intval($value) <= $total_days; }); $rules = array('picture' => 'Required|Mimes:jpeg|Max:2048', 'image_title' => array('Required', 'Regex:/[\\p{L}\\-_ 0-9]+/u', 'Max:150'), 'drawn_by' => array('Required', 'Regex:/[\\p{L}][\\p{L}\\- ]+/u', 'Max:150'), 'dob_year' => 'Required|Integer|Between:1999,2013', 'dob_month' => 'Required|Integer|Between:1,12', 'dob_day' => 'Required|Integer|Between:1,31|day_of_month', 'title' => array('Required', 'Regex:/^(Mr|Mrs|Ms|Miss|Other)$/'), 'forename' => array('Required', 'Regex:/[\\p{L}][\\p{L}\\- ]+/u', 'Max:150'), 'surname' => array('Required', 'Regex:/[\\p{L}][\\p{L}\\- ]+/u', 'Max:150'), 'address' => array('Required', 'Regex:/[\\p{L}\\-_ 0-9]+/u', 'Max:150'), 'town' => array('Required', 'Max:50', 'Regex:/[\\p{L}\\- ]+/u'), 'country' => 'In:England,Scotland,Wales,Northern Ireland,Republic of Ireland', 'postcode' => array('Regex:/^([a-pr-uwyz]((\\d{1,2})|([a-hk-y]\\d{1,2})|(\\d[a-hjkstuw])|([a-hk-y]\\d[a-z])) *\\d[abd-hjlnp-uw-z]{2})?$/i', 'Max:10'), 'email' => 'Required|Email|Confirmed', 'email_confirmation' => 'Required|Email', 'terms' => 'Required'); $messages = array('picture.mimes' => "Sorry - our systems don't recognise the type of file you've uploaded. Please have another go with a jpg file", 'picture.max' => "Sorry - the file you've tried to upload is too big for our systems! Please have another go with a smaller jpg", 'image_title.required' => "Oops, your drawing doesn't have a title", 'drawn_by.required' => "Sorry, our systems don't recognise the drawer’s name you've entered. We just want a first name with no numbers or symbols and it must start with a letter. Please try again!", 'drawn_by.regex' => 'Sorry, the name can only contain letters, spaces, and hyphens and it must start with a letter', 'dob_year:required' => 'Sorry, you must enter a year of birth', 'dob_year.integer' => 'Sorry, your year of birth must be between 1999 and the present', 'dob_year.between' => 'Sorry, your year of birth must be between 1999 and the present', 'dob_month:required' => 'Sorry, you must enter the month the drawer was born', 'dob_month.integer' => 'Sorry, the month the drawer was born must be a number from 1 to 12', 'dob_month.between' => 'Sorry, the month the drawer was born must be a number from 1 to 12', 'dob_day.required' => 'Sorry, you need to enter the day of the month the drawer was born', 'dob_day.integer' => 'Sorry, the day of the month the drawer was born should be between 1 and 31', 'dob_day.between' => 'Sorry, the day of the month the drawer was born should be between 1 and 31', 'dob_day.day_of_month' => 'Sorry, that month doesn\'t have that many days!', 'forename.required' => "Hello stranger. We're missing your first name.", 'forename.regex' => 'Sorry, the name can only contain letters, spaces, and hyphens', 'surname.required' => "We're missing your surname.", 'surname.regex' => 'Sorry, the name can only contain letters, spaces, and hyphens', 'address.required' => "We need your address so, if you win, the postman knows where to deliver your petrifying prize.", 'town.required' => "Where do you live?", 'postcode.required' => "Don't forget to pop in your post code.", 'postcode.regex' => "Sorry, our systems don’t recognise what you've entered as a post code. Please use a regular UK format, like KT22 7GR.", 'email.required' => "What's your email?", 'email.email' => "Sorry, our systems don't recognise what you've entered as an email. Please use a regular email format, like info@Persil.com", 'email.confirmed' => "Sorry, the emails you’ve entered don’t match up. Please check them and have another go.", 'terms.required' => "See that tiny box? You need to tick it if you agree to the terms and conditions."); $input = Input::all(); // note to self - all() is required instead of get() if processing uploads - just wasted a good hour hunting down this little bug $input['dob_day'] = trim($input['dob_day'], '0'); $input['dob_month'] = trim($input['dob_month'], '0'); $validator = Validator::make($input, $rules, $messages); if ($validator->fails()) { // spit out the form again with the errors shown return View::make('includes/template')->with('template', 'form')->with('errors', $validator->messages())->with('input', $input); } else { // first - process the image $image = Persil::save_uploaded_image($input); $added = Persil::insert_user_data($input); $traction_added = Persil::post_traction_data($input, $this->url, $this->password); if ($image && $added) { // push the validated data into the session so that it can be shown in the form again if they go to make another submission Session::put('submitted_data', array()); foreach ($input as $key => $value) { if ($key != 'picture') { Session::push("submitted_data.{$key}", $value); } } //Session::put('submitted_data', $input); return View::make('includes/template')->with('template', 'confirmation')->with('input', $input); } else { echo 'error page'; } // this will probably be the form again with some generic error message or something } } }
public function validate($input_arr = array()) { $this->validate_errors = array(); $rules = array('email' => 'required|email|in_database'); Validator::extend('in_database', function ($attribute, $value, $parameters) use($input_arr) { Log::info('in database ' . $value); return CheckAlertEmail::where('check_id', '=', isset($input_arr['check_id']) && ($c = $input_arr['check_id']) ? $c : 0)->where('alert_email', '=', $value)->count() == 0; }); $validator = Validator::make($input_arr, $rules); if ($validator->fails()) { $this->set_custom_attributes($validator, array('email' => $input_arr['email'], 'action' => $input_arr['action'])); //$this->validate_errors = $validator->messages()->all(); return false; } else { return true; } }