i added a custom validation rule in a service provider like this
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class ValidatorServiceProvider extends ServiceProvider {
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot() {
$this->app['validator']->extend('chk', function ($attribute, $value, $parameters) {
if(some_check){
return true;
}else{
//add error message
}
});
}
public function register() {
}
}
but i want it to add an error message instead of returning false, how to do that ?