1. Go to this page and download the library: Download edulazaro/laratox library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
edulazaro / laratox example snippets
use ToxicFilter;
$verdict = ToxicFilter::text($comment->body)->check();
if ($verdict->blocked()) {
return back()->withErrors(['body' => $verdict->reason()]);
}
$comment->hidden = $verdict->needsReview();
ToxicFilter::text($listing->description)
->policy('marketplace') // one of your policies, instead of the default
->project('shop') // one of your projects, instead of TOXICFILTER_PROJECT
->locale('es') // the language it should be in
->surface('listing') // where it appears
->reference("listing_{$listing->id}")
->check();
use ToxicFilter\Exception\ApiError;
use ToxicFilter\Exception\QuotaExhausted;
try {
$verdict = ToxicFilter::text($comment->body)->check();
} catch (QuotaExhausted $e) {
// Out of credits: $e->remaining(), $e->
use EduLazaro\Laratox\Rules\Moderated;
$request->validate([
'body' => ['bail', '