PHP code example of kaankilic / wtfilter

1. Go to this page and download the library: Download kaankilic/wtfilter 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/ */

    

kaankilic / wtfilter example snippets


composer 

Kaankilic\WTFilter\Providers\WTFilterServiceProvider::class,

'WTFilter' => Kaankilic\WTFilter\Facades\WTFilter::class

php artisan vendor:publish --provider="Kaankilic\WTFilter\Providers\WTFilterServiceProvider"



namespace App\Http\Controllers;

use WTFilter;

class CommentsController extends Controller
{
    /**
     * It's filtering your comments that contains profanities.
     */
    public function createComment(Request $request){
    	$contentOfComments = WTFilter::filter($request->get("content_of_comment"));
        
    }
}

 
...
use Kaankilic\WTFilter\Traits\FilterableWords;
class CustomModel extends Model{
	use FilterableWords;

	public function filterable(){
		return [
        	"sources" => ["title"], // trait gonna check this columns
        	"flag" => "has_profanity" // *optionally you can set flag to any column
    	];
    }
...