Skip to content

Commit 5808884

Browse files
committed
readme update
1 parent 63ce823 commit 5808884

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,31 @@ Add these (and an Event Listener) to your `EventServiceProvider.php` file to mak
153153

154154
## Built in CAPTCHA / anti spam
155155

156-
There is a built in captcha (anti spam comment) system built in, which will be easy for you to replace with your own implementation.
156+
There is a built-in captcha (anti-spam comment) system built in, which will be easy for you to replace with your own implementation.
157157

158-
Please see [this Captcha docs](https://binshops.binshops.com/laravel-blog-package#captcha) for more details.
158+
There is a basic anti-spam captcha function built-in.
159+
160+
See the config/binshops.php captcha section. There is a built in system (basic!) that will prevent most automated spam attempts.
161+
Writing your own captcha system:
162+
163+
I wrote the captcha system simple on purpose, so you can add your own captcha options. It should be easy to add any other captcha system to this.
164+
165+
If you want to write your own implementation then create your own class that implements \BinshopsBlog\Interfaces\CaptchaInterface, then update the config/binshopsblog.php file (change the captcha_type option).
166+
167+
There are three methods you need to implement:
168+
public function captcha_field_name() : string
169+
170+
Return a string such as "captcha". It is used for the form validation and <input name=???>.
171+
public function view() : string
172+
173+
What view file should the binshops::partials.add_comment_form view include? You can set this to whatever you need, and then create your own view file. The default included basic captcha class will return "binshops::captcha.basic".
174+
public function rules() : array
175+
176+
Return an array for the rules (which are just the standard Laravel validation rules. This is where you can check if the captcha was successful or not.
177+
Optional:
178+
public function runCaptchaBeforeShowingPosts() : null
179+
180+
This isn't part of the interface, it isn't required. By default it does nothing. But you can put some code in this method and it'll be run in the BinshopsReaderController::viewSinglePost method.
159181

160182
## Image upload errors
161183

0 commit comments

Comments
 (0)