error message if message too short

This commit is contained in:
Christophe LATOUR 2017-12-20 17:00:07 +01:00
parent 97d1be40c8
commit 85c039902d

View File

@ -2,9 +2,23 @@
namespace App\Web\Controllers;
use Illuminate\Http\Request;
use Antadis\API\Front\Exceptions\HttpBadRequestException;
use Antadis\API\Front\Web\Controllers\ContactController as BaseContactController;
use ApiTools;
class ContactController extends BaseContactController
{
public function create(Request $request) {
$msg = ApiTools::getValue('msg', false);
if (strlen($msg) < 20) {
throw new HttpBadRequestException('Votre message doit contenir plus de 20 caractères.');
}
return parent::create($request);
}
}