You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,9 +153,31 @@ Add these (and an Event Listener) to your `EventServiceProvider.php` file to mak
153
153
154
154
## Built in CAPTCHA / anti spam
155
155
156
-
There is a builtin captcha (antispam 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.
157
157
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 <inputname=???>.
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.
0 commit comments